[gdal-dev] shp-gpx conversion with ogr2ogr

Frank Warmerdam warmerdam at pobox.com
Mon Jun 8 13:02:47 EDT 2009


flavio rigolon wrote:
> Hi all,
>  I'm trying to convert a SHP file to GPX via ogr2ogr.
> 
> The "default" conversion works well:
> 
> <http://www.gdal.org/ogr/drv_gpx.html>$ ogr2ogr -f GPX nome_file.gpx 
> nome_file.shp
> 
> I'd like to mantain two attributes and I tried the option 
> GPX_USE_EXTENSIONS=YES with sql instruction to rename the interested fields:
> 
> $ ogr2ogr -f GPX -dsco GPX_USE_EXTENSION=YES -sql "SELECT NOME AS name, 
> CAT AS desc FROM source_layer" nome_file.gpx nome_file.shp
> 
> but I get this error:
> --------------------------------
> ERROR 1: SQL: Missing comma after column NOME in SELECT statement
> --------------------------------
> It seems that I forgot a comma but this command is the same in the 
> documentation.
> 
> I've checked the syntax with the help of this doc:
> http://www.gdal.org/ogr/drv_gpx.html
> http://www.gdal.org/ogr/drv_vrt.html
> 
> but I don't understand where is the error.
> Does anibody have similar experience?

Flavio,

I found the above syntax worked in trunk, and 1.6 but not in 1.5.  I suspect
you are using 1.5.x or earlier binaries that do not support the AS operator
for renaming fields.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list