Categories
GIS

Interfacing the Pharos GPS-500 to Mac OS X

Update 2015: This is very old. I don’t know the status of a decent OS X 10.10 driver for the Prolific PL-2303 in this GPS.

I’m stopping short of calling this “Using the Pharos GPS-500 to Mac OS X” because all I’ve been able to do is read raw NMEA sentences from the device. But that might be of use to you.

The Source is clearing out copies of Microsoft Street & Trips with GPS 2008 for $20. The GPS is a very simple USB Pharos GPS-500, which uses the SiRF III chipset. Between the USB cable and the GPS is a small black box which looks suspiciously like a serial to USB converter. I have no use for the software, but the GPS is a bargain, considering a similar bare unit costs $60.

Plugging it into a Mac does nothing beyond being recognized as a “USB-Serial Controller D” from Prolific Technology, Inc. The ancient driver on Pharos’ website identifies the serial chipset as the Prolific PL2303. The only driver I could get to work with Snow Leopard was the failberg/osx-pl2303, a fork of an earlier project from Sourceforge. You’ll know if it’s working when you get a device called /dev/tty.PL2303-something appear.

Reading the data’s pretty simple if you have GNU Screen installed. I entered the following command:

screen /dev/tty.PL2303-12345678^XX^D?^XX 4800

and very quickly started to get NMEA data scrolling in the terminal:

$GPRMC,003322.000,A,4343.8349,N,07915.8845,W,0.38,112.13,211210,,,A*7B
$GPGGA,003323.000,4343.8351,N,07915.8838,W,1,05,2.8,174.3,M,-35.1,M,,0000*65
$GPGSA,A,3,09,18,14,21,22,,,,,,,,6.9,2.8,6.3*34
$GPRMC,003323.000,A,4343.8351,N,07915.8838,W,0.89,122.04,211210,,,A*76
$GPGGA,003324.000,4343.8351,N,07915.8843,W,1,06,1.5,176.0,M,-35.1,M,,0000*62
$GPGSA,A,3,27,09,18,14,21,22,,,,,,,3.4,1.5,3.1*30
$GPGSV,3,1,12,18,78,082,28,22,61,307,27,09,56,076,30,27,40,053,19*7F
$GPGSV,3,2,12,14,38,254,18,21,32,180,21,15,27,062,16,26,12,059,*7E
$GPGSV,3,3,12,19,10,302,,12,07,119,,06,04,261,,03,02,272,*7E

To stop screen, type Control-A K. Do not just unplug the GPS, as you risk your machine crashing.

These NMEA sentences can easily be converted to GPX.

Categories
Uncategorized

Mac OS X killed my Garmin!

My GPSMAP 60CSx had started to become unreliable: crashing after startup, randomly locking up in mid route, and just generally being an aggravating piece of kit. I was really close to replacing it.

The problem seemed to appear after I’d used USB Mass Storage to transfer archived track logs to the computer. As a last resort, I tried removing the hidden files that OS X creates on every removable disk, and now all is well. It’s annoying and inexcusable that Apple chooses to do this, but we work around.

To delete these files from the terminal and eject the device safely, enter these commands:

pushd /Volumes/GARMIN/
rm -rf .Spotlight-V100 .Trashes ._.Trashes .fseventsd
popd
disktool -e disk1

Your device might not be called /Volumes/GARMIN/, so check and change appropriately. If you have multiple drives on your machine, your GPS is probably not the disk1 device. You can find out which it is by entering disktool -l.

Categories
GIS

proj.4 init annoyances: it’s all apple’s fault

I was going to write a rant about how Ubuntu sets up proj.4 init files incorrectly, then I found that the problem actually lies with OS X. OS X is unusual for a Unix variant, as it uses a case-insensitive file system; flarp.txt is the same as FLARP.TXT. Under more traditional Unices, they’d be different files.

Most of the examples on this blog were written under OS X, and I was concerned when they didn’t work under Ubuntu. It seems that proj.4 uses a very simple way of defining initialization files. If you specify, say, “+init=EPSG:2958”, proj digs around in its configuration files for a file called EPSG, then searches for an identifier in that file which matches the ID 2958. Under OS X, you can specify EPSG, epsg, or even EpSg – they all work. Under Ubuntu, using anything other that epsg fails with this message:

<proj>:
projection initialization failure
cause: no system list, errno: 2

In short, use lower case init specifications, and it’ll work everywhere.

It seems that there are some other applications (mapserver?) that have problems calling proj, so if you’re seeing this error and it’s not something you can correct from the command line:

  1. Find out where your installation keeps its initialization files. You can do this by setting PROJ_DEBUG=1:
    PROJ_DEBUG=1 proj +init=epsg:2958
    and you should get a message like:
    pj_open_lib(epsg): call fopen(/usr/share/proj/epsg) - succeeded
  2. cd /usr/share/proj (or wherever the last command said the epsg file was located)
  3. sudo ln -s epsg EPSG

Now your installation should work no matter which case you use. Camel case, unfortunately, excluded.