Hello,

Le 04/07/2011 15:43, Pekka Hurskainen claviota:
Hi Micha,
thanks for the tip! I managed to do it with the following command from FWTools shell:

ogr2ogr -update -append -f "PostgreSQL" PG:"host=localhost user=postgres dbname=db password=xxx" my_gps_points.gpx waypoints -sql "SELECT name AS gps_nimi, time AS gps_aika FROM waypoints" -t_srs EPSG:3067 -nln
my_table_name

Looks neat.
What I usually do for such tasks is to generate a .csv using the Marvelous gpsbabel. You can define a template and fine-tune it to your needs. See the manual page or its documentation. After, I have a few bash scripts which automagically dump .csv files into my database tables.

I selected the fields I wanted, and cast them to different field names in my db table. I only wanted waypoints, and also did a coordinate transformation from wgs84 -> ETRS-TM35FIN. Very handy, once you get the syntax right. Now the only manual thing left is to change the input gpx file name every time, if all other parameters stay constant.

If all your input files are stored in a directory, you can write a simple script, something like:

for i in *.gpx ;
do
ogr2ogr -update -append -f "PostgreSQL" PG:"host=localhost user=postgres dbname=db password=xxx" $i waypoints -sql "SELECT name AS gps_nimi, time AS gps_aika FROM waypoints" -t_srs EPSG:3067 -nln
my_table_name
;  done


This will proceed all your files.
This was in bash, but you can write something in any other (decent) shell, or in python, whatever you like. And if the files are scattered in a directory structure, you can "walk" through it, python has some neat tools for this. And all (decent) shells also, of course.


    Any ideas?


Plenty! ;)

À+
Pierre
--

____________________________________________________________________________
Pierre Chevalier Géologue EI
    Mesté Duran
    32100 Condom
  Tél+fax  :    09 75 27 45 62
                05 62 28 06 83
                06 37 80 33 64
  Émail  :   pierrechevaliergeolCHEZfree.fr
  icq#   :   10432285
  skype  :   pierre.chevalier1967
  http://pierremariechevalier.free.fr/pierre_chevalier_geologue
____________________________________________________________________________

_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to