[postgis-users] Import gpx files into Postgis db (windows)?

Nicolas Ribot nicolas.ribot at gmail.com
Tue Nov 4 02:20:41 PST 2014


Hi James,

I don't know well the GPX format, but it seems several types of geo objects
can be stored (waypoints, routes, tracks, route_points,  track_points).
OGR will read each of these layers and create a postgis table for them:

ogrinfo command lists the layers:

$ ogrinfo sample.gpx
Had to open data source read-only.
INFO: Open of `sample.gpx'
      using driver `GPX' successful.
1: waypoints (Point)
2: routes (Line String)
3: tracks (Multi Line String)
4: route_points (Point)
5: track_points (Point)

(with -al -so switches, you get details of each layer)

To load the file in a PG database:

ogr2ogr -f PostgreSQL PG:"dbname=test" sample.gpx

5 tables corresponding to the layers will be created.
The PG:"..." part is used to configure the database connection (port,
username, password, ...)

test=# \dt
               Liste des relations
 Schéma |       Nom       | Type  | Propriétaire
--------+-----------------+-------+--------------
 public | route_points    | table | nicolas
 public | routes          | table | nicolas
 public | spatial_ref_sys | table | nicolas
 public | track_points    | table | nicolas
 public | tracks          | table | nicolas
 public | waypoints       | table | nicolas
(6 lignes)

Nicolas

On 4 November 2014 10:52, James David Smith <james.david.smith at gmail.com>
wrote:

> Hi Nicolas,
>
> Thanks for pointing Dandrigo towards the GPX driver for GDAL - I
> didn't know it existed to be honest so saw your reply with interest.
> Would you mind, if possible, giving a sample line or two about how
> someone could create a new table in PostGIS from the GPX please? The
> examples in the documentation aren't that clear (or perhaps I just
> don't understand them!).
>
> Regards
>
> James
>
> On 3 November 2014 08:06, Nicolas Ribot <nicolas.ribot at gmail.com> wrote:
> > Hello,
> >
> > You can use GDAL/OGR, (ogr2ogr): http://www.gdal.org/drv_gpx.html
> >
> > Nicolas
> >
> > On 31 October 2014 18:32, dandrigo <lcelati at latitude-geosystems.com>
> wrote:
> >>
> >> Dear all,
> >>
> >> I'm working with windows 8 & postgis 2.1.
> >>
> >> I have several gps (gpx) files. I would like to import directly those
> gpx
> >> files into my postgis database.
> >>
> >> What would be the easiest way?
> >>
> >> In advance, thank you to throw light for me.
> >>
> >> Regards.
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://postgis.17.x6.nabble.com/Import-gpx-files-into-Postgis-db-windows-tp5007255.html
> >> Sent from the PostGIS - User mailing list archive at Nabble.com.
> >> _______________________________________________
> >> postgis-users mailing list
> >> postgis-users at lists.osgeo.org
> >> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> >
> >
> >
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at lists.osgeo.org
> > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20141104/14eae12e/attachment.html>


More information about the postgis-users mailing list