[gdal-dev] Fwd: ogr2ogr. SQL seems to disable use_gpx_extensions

Pedro Machado Monteiro pedromachadomonteiro at gmail.com
Fri Sep 12 11:35:34 PDT 2014


Thank you very much, Even.

By the way, unlike the alias for the tag <*cmt*>, the alias for the tag <
*desc*> gave me a syntax error in the SQL:

F:\usbgis\apps\ms4w
GDAL, mapserv, mapcache, PROJ, and shapelib dll paths set
GDAL_DATA path set
GDAL_DRIVER_PATH set
PROJ_LIB set
CURL_CA_BUNDLE set
F:\usbgis\apps\ms4w\tools\gdal-ogr>ogr2ogr -f GPX -dsco
GPX_USE_EXTENSIONS=YES D:\Si\Gps\FaunaPnpg_w
gs84_testeA.gpx D:\Si\Gps\FaunaPnpg_wgs84_teste_utf8.shp -sql "SELECT Linha
AS name , IDENTIFICA AS
*cmt* FROM FaunaPnpg_wgs84_teste_utf8"

F:\usbgis\apps\ms4w\tools\gdal-ogr>ogr2ogr -f GPX -dsco
GPX_USE_EXTENSIONS=YES D:\Si\Gps\FaunaPnpg_w
gs84_testeB.gpx D:\Si\Gps\FaunaPnpg_wgs84_teste_utf8.shp -sql "SELECT Linha
AS name , IDENTIFICA AS
*desc* FROM FaunaPnpg_wgs84_teste_utf8"
ERROR 1: SQL Expression Parsing Error: syntax error


F:\usbgis\apps\ms4w\tools\gdal-ogr>


And the same thing happens with all fields in the <extensions>:

F:\usbgis\apps\ms4w
GDAL, mapserv, mapcache, PROJ, and shapelib dll paths set
GDAL_DATA path set
GDAL_DRIVER_PATH set
PROJ_LIB set
CURL_CA_BUNDLE set
F:\usbgis\apps\ms4w\tools\gdal-ogr>ogr2ogr -f GPX -dsco
GPX_USE_EXTENSIONS=YES D:\Si\Gps\FaunaPnpg_w
gs84_testeC.gpx D:\Si\Gps\FaunaPnpg_wgs84_teste_utf8.shp -sql "SELECT Linha
AS name , IDENTIFICA AS
*cmt* , * FROM FaunaPnpg_wgs84_teste_utf8"

F:\usbgis\apps\ms4w\tools\gdal-ogr>ogr2ogr -f GPX -dsco
GPX_USE_EXTENSIONS=YES D:\Si\Gps\FaunaPnpg_w
gs84_testeD.gpx D:\Si\Gps\FaunaPnpg_wgs84_teste_utf8.shp -sql "SELECT Linha
AS name , IDENTIFICA AS
*desc* , * FROM FaunaPnpg_wgs84_teste_utf8"
ERROR 1: SQL Expression Parsing Error: syntax error

F:\usbgis\apps\ms4w\tools\gdal-ogr>

Is there any special issue about this tag?

With my best regards

Pedro Monteiro











2014-09-12 9:22 GMT+01:00 Even Rouault <even.rouault at spatialys.com>:

> Selon Pedro Machado Monteiro <pedromachadomonteiro at gmail.com>:
>
> > Hello:
> >
> >
> >
> > Iâ  m trying to export a shapefile to a GPX file, with GDAL 1.9.0
> ogr2ogr.
> >
> >
> >
> > From the shapefile attribute table, I want  to export some fields to  the
> > corresponding tags of the GPX file, and the remaining (or all) fields to
> > the <extensions> tag
> >
> >
> >
> > That doesâ  nt seem to work: when I use the *â  sql* option SELECT AS
> (ex: to
> > export the field â  Linhaâ   from the shape attribute table, to the GPX
> > <name>), it seems that the *-dsco* option USE_GPX_EXTENSIONS=YES is
> > disabled, because the result always lacks the <extensions> tag, with the
> > remaining (or all) fields.
> >
> >
> > But http://gdal.org/drv_gpx.html says that If GPX_USE_EXTENSIONS=YES is
> > specified, extra fields will be written inside the*<extensions>* tag.
> >
> >
> >
> > Here is the kind of statement:
> >
> >
> >
> > *ogr2ogr* *-f* GPX *-dsco* GPX_USE_EXTENSIONS=YES exportfile.gpx
> > sourcefile.shp
> > *-sql* *"*SELECT Linha AS name FROM sourcefile*"*
>
> Pedro,
>
> The above SQL statement only selects one single field from the shapefile,
> so it
> is expected that the resulting GPX will have only the standard <name>
> attribute.
> You must explicitely list other fields in the SELECT clause if you want
> them to
> go in <extensions>.
> If you want to be quick and don't mind the Linha field to be in the
> extensions
> as well in addition to <name>, you can just do "SELECT Linha AS name, *
> FROM
> sourcefile"
>
> Best regards,
>
> Even
>
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140912/722a2dae/attachment-0001.html>


More information about the gdal-dev mailing list