Opened 13 years ago

Closed 13 years ago

#4190 closed defect (invalid)

ogr2ogr -f GPX doesn't work with -sql, claims unknown geometry type

Reported by: tbnorth Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: 1.8.0
Severity: normal Keywords:
Cc:

Description

ogr2ogr --version GDAL 1.8.0, released 2011/01/12

GPX driver gives

ogr2ogr -f gpx del.gpx  PG:"XXX" -sql 'select pointid as name, st_transform(geom,4326) from coord'
ERROR 6: Cannot create GPX layer sql_statement with unknown geometry type
ERROR 1: Terminating translation prematurely after failed

this works:

ogr2ogr -f gpx del.gpx PG:"XXX" coord

but *only* if coord has an entry in geometry_columns

According to http://www.gdal.org/ogr/drv_gpx.html you should be able to use -sql to remap field names, so this might be a regression

Change History (1)

comment:1 by Even Rouault, 13 years ago

Resolution: invalid
Status: newclosed

No, there is no regression. This is the expected behaviour. The GPX driver needs to know the geometry type of the layer. But when you use a SQL request, we cannot know it (contrary to the case when you use directly a table and the PG driver can find in the geometry_columns the geometry type). So you have to explictely specify the geometry type with the -nlt option of ogr2ogr.

Note: See TracTickets for help on using tickets.