Hello folks,

I am importing multiple gpx files into a postgis database. The tables 'tracks' 
and 'track_points' are created / updated.

The column track_fid in in the track_points table should be a reference to the 
track feature id as documented in https://gdal.org/drivers/vector/gpx.html, 
however it is always zero. 

Is this a bug or am I missing something?


      Details

I am creating an empty database, then create postgis extension with 'CREATE 
EXTENSION POSTGIS'

I have two simple gpx files ( see attachments )

  * file1.gpx - containing 2 track segments - each with 3 track points
  * file2.gpx - containing 1 track segment  with 3 track points

I am using commands

ogr2ogr -f PostgreSQL -update -append "PG:dbname=testdb host=localhost 
user=postgres password=xx port=5432" file1.gpx

ogr2ogr -f PostgreSQL -update -append "PG:dbname=testdb host=localhost 
user=postgres password=xx port=5432" file2.gpx

Resulting data in 'tracks'

ogc_fid         name    cmt     desc    src     link1_href      link1_text      
link1_type      link2_href      link2_text      link2_type      number  type    
wkb_geometry
1       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    
NULL    NULL    NULL    ...
2       NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    
NULL    NULL    NULL    ...

ogc_fid         track_fid       track_seg_id    track_seg_point_id      ele     
time    .... other columns omitted ...
1       0       0       0       1       NULL    
2       0       0       1       1       NULL    
3       0       0       2       1       NULL    
4       0       1       0       2       NULL    
5       0       1       1       2       NULL    
6       0       1       2       2       NULL    
7       0       0       0       3       NULL    
8       0       0       1       3       NULL    
9       0       0       2       3       NULL    

Expected:

ogc_fid         track_fid       track_seg_id    track_seg_point_id      ele     
time    .... other columns omitted ...
1       1
        0       0       1       NULL    
2       1
        0       1       1       NULL    
3       1
        0       2       1       NULL    
4       1
        1       0       2       NULL    
5       1
        1       1       2       NULL    
6       1
        1       2       2       NULL    
7       2
        0       0       3       NULL    
8       2
        0       1       3       NULL    
9       2
        0       2       3       NULL    

I also tried to omit -update -append, but same result.

Versions:

  * Postgres: "PostgreSQL 12.5 on x86_64-pc-linux-musl, compiled by gcc (Alpine 
9.3.0) 9.3.0, 64-bit"
  * Postgis: "POSTGIS="3.0.3 0" [EXTENSION] PGSQL="120" 
GEOS="3.8.1-CAPI-1.13.3" PROJ="7.0.1" LIBXML="2.9.10" LIBJSON="0.14" 
LIBPROTOBUF="1.3.3" WAGYU="0.4.3 (Internal)""
  * Gdal: 3.2.0

_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to