On Thu, Dec 2, 2010 at 12:47 PM, Jeff Hamann <jeff.d.hamann@gmail.com> wrote:
I'm thinking about adding an additional format for exporting data to a SQL database (i.e. postgresql possibly with postgis extension). 

My thinking is that I can combine the arguments from gpsbabel and ogr2ogr. 

I think that current GDAL actually has GPSBabel support in it. 



 
The first half of the args are already in the gpsbabel arguments:

$ gpsbabel -T -i nmea -f /dev/cu.usbserial -o kml -F tracking.kml

The second part of the argument list is to write the inputs directly into a database, like you would do from ogr2ogr:

ogr2ogr -append -f  "PostgreSQL" PG:"host=192.168.0.7 user=hamannj dbname=tachrv12" -nln user_roads2 -a_srs EPSG:2286 BNDRY.mdb layer Roads_24K_WA

This falls into the category of "stupid GPSBabel tricks", but a few of us have written one-off csv style sheets that are just "insert into foo (lat, lon, blah) values(...)" lines.

$ gpsbabel -T -i nmea -f /dev/cu.usbserial -o postgresql -F "PG: host=192.168.0.7 user=something dbname=gpslogs" -a gps_log_table_name

The closing quote is in the wrong place there, isn't it?
 
where the code would create a connection to the database, and parse the data accordingly into SQL statements and send them to the server.

Would modifying gpsd be a better option?

Any advice, ideas, potential trouble spots before I would begin? 

We don't have portable infrastructure for things like opening sockets and introducing a requirement on some kin of postgresql libraries would be an uncomfortable one.   How exactly do you foresee that working?

RJL