<div dir="ltr">Thank you very much, Even.<div><br></div><div>By the way, unlike the alias for the tag <<b>cmt</b>>, the alias for the tag <<b>desc</b>> gave me a syntax error in the SQL:</div><div><br></div><div><div><span style="background-color:rgb(238,238,238)">F:\usbgis\apps\ms4w</span></div><div><span style="background-color:rgb(238,238,238)">GDAL, mapserv, mapcache, PROJ, and shapelib dll paths set</span></div><div><span style="background-color:rgb(238,238,238)">GDAL_DATA path set</span></div><div><span style="background-color:rgb(238,238,238)">GDAL_DRIVER_PATH set</span></div><div><span style="background-color:rgb(238,238,238)">PROJ_LIB set</span></div><div><span style="background-color:rgb(238,238,238)">CURL_CA_BUNDLE set</span></div><div><span style="background-color:rgb(238,238,238)">F:\usbgis\apps\ms4w\tools\gdal-ogr>ogr2ogr -f GPX -dsco GPX_USE_EXTENSIONS=YES D:\Si\Gps\FaunaPnpg_w</span></div><div><span style="background-color:rgb(238,238,238)">gs84_testeA.gpx D:\Si\Gps\FaunaPnpg_wgs84_teste_utf8.shp -sql "SELECT Linha AS name , IDENTIFICA AS</span></div><div><span style="background-color:rgb(238,238,238)"><b><font color="#0000ff">cmt</font></b> FROM FaunaPnpg_wgs84_teste_utf8"</span></div><div><span style="background-color:rgb(238,238,238)"><br></span></div><div><span style="background-color:rgb(238,238,238)">F:\usbgis\apps\ms4w\tools\gdal-ogr>ogr2ogr -f GPX -dsco GPX_USE_EXTENSIONS=YES D:\Si\Gps\FaunaPnpg_w</span></div><div><span style="background-color:rgb(238,238,238)">gs84_testeB.gpx D:\Si\Gps\FaunaPnpg_wgs84_teste_utf8.shp -sql "SELECT Linha AS name , IDENTIFICA AS</span></div><div><span style="background-color:rgb(238,238,238)"><b><font color="#ff0000">desc</font></b> FROM FaunaPnpg_wgs84_teste_utf8"</span></div><div><span style="background-color:rgb(238,238,238)">ERROR 1: SQL Expression Parsing Error: syntax error</span></div><div><span style="background-color:rgb(238,238,238)"><br></span></div><div><span style="background-color:rgb(238,238,238)"><br></span></div><div><span style="background-color:rgb(238,238,238)">F:\usbgis\apps\ms4w\tools\gdal-ogr></span><br></div></div><div><span style="background-color:rgb(238,238,238)"><br></span></div><div><br></div><div>And the same thing happens with all fields in the <extensions>:<span style="background-color:rgb(238,238,238)"><br></span></div><div><span style="background-color:rgb(238,238,238)"><br></span></div><div><div><span style="background-color:rgb(204,204,204)">F:\usbgis\apps\ms4w</span></div><div><span style="background-color:rgb(204,204,204)">GDAL, mapserv, mapcache, PROJ, and shapelib dll paths set</span></div><div><span style="background-color:rgb(204,204,204)">GDAL_DATA path set</span></div><div><span style="background-color:rgb(204,204,204)">GDAL_DRIVER_PATH set</span></div><div><span style="background-color:rgb(204,204,204)">PROJ_LIB set</span></div><div><span style="background-color:rgb(204,204,204)">CURL_CA_BUNDLE set</span></div><div><span style="background-color:rgb(204,204,204)">F:\usbgis\apps\ms4w\tools\gdal-ogr>ogr2ogr -f GPX -dsco GPX_USE_EXTENSIONS=YES D:\Si\Gps\FaunaPnpg_w</span></div><div><span style="background-color:rgb(204,204,204)">gs84_testeC.gpx D:\Si\Gps\FaunaPnpg_wgs84_teste_utf8.shp -sql "SELECT Linha AS name , IDENTIFICA AS</span></div><div><span style="background-color:rgb(204,204,204)"><font color="#0000ff"><b>cmt</b></font> , * FROM FaunaPnpg_wgs84_teste_utf8"</span></div><div><span style="background-color:rgb(204,204,204)"><br></span></div><div><span style="background-color:rgb(204,204,204)">F:\usbgis\apps\ms4w\tools\gdal-ogr>ogr2ogr -f GPX -dsco GPX_USE_EXTENSIONS=YES D:\Si\Gps\FaunaPnpg_w</span></div><div><span style="background-color:rgb(204,204,204)">gs84_testeD.gpx D:\Si\Gps\FaunaPnpg_wgs84_teste_utf8.shp -sql "SELECT Linha AS name , IDENTIFICA AS</span></div><div><span style="background-color:rgb(204,204,204)"><font color="#ff0000"><b>desc</b></font> , * FROM FaunaPnpg_wgs84_teste_utf8"</span></div><div><span style="background-color:rgb(204,204,204)">ERROR 1: SQL Expression Parsing Error: syntax error</span></div><div><span style="background-color:rgb(204,204,204)"><br></span></div><div><span style="background-color:rgb(204,204,204)">F:\usbgis\apps\ms4w\tools\gdal-ogr></span></div></div><div><span style="background-color:rgb(204,204,204)"><br></span></div><div><font color="#000000">Is there any special issue about this tag? </font></div><div><font color="#000000"><br></font></div><div><font color="#000000">With my best regards</font></div></div><div class="gmail_extra"><br clear="all"><div><p><span style="font-size:11pt;color:rgb(31,73,125)">Pedro Monteiro</span></p><p></p><p><font color="#1f497d"><span style="font-size:15px"><br></span></font></p><p><br> </p><br><br>
<p> <br></p><p><br></p><br></div>
<br><div class="gmail_quote">2014-09-12 9:22 GMT+01:00 Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Selon Pedro Machado Monteiro <<a href="mailto:pedromachadomonteiro@gmail.com">pedromachadomonteiro@gmail.com</a>>:<br>
<br>
> Hello:<br>
><br>
><br>
><br>
> Iâ m trying to export a shapefile to a GPX file, with GDAL 1.9.0 ogr2ogr.<br>
<span class="">><br>
><br>
><br>
> From the shapefile attribute table, I want to export some fields to the<br>
> corresponding tags of the GPX file, and the remaining (or all) fields to<br>
> the <extensions> tag<br>
><br>
><br>
><br>
</span>> That doesâ nt seem to work: when I use the *â sql* option SELECT AS (ex: to<br>
> export the field â Linhaâ from the shape attribute table, to the GPX<br>
> <name>), it seems that the *-dsco* option USE_GPX_EXTENSIONS=YES is<br>
<span class="">> disabled, because the result always lacks the <extensions> tag, with the<br>
> remaining (or all) fields.<br>
><br>
><br>
> But <a href="http://gdal.org/drv_gpx.html" target="_blank">http://gdal.org/drv_gpx.html</a> says that If GPX_USE_EXTENSIONS=YES is<br>
</span>> specified, extra fields will be written inside the*<extensions>* tag.<br>
<span class="">><br>
><br>
><br>
> Here is the kind of statement:<br>
><br>
><br>
><br>
</span>> *ogr2ogr* *-f* GPX *-dsco* GPX_USE_EXTENSIONS=YES exportfile.gpx<br>
> sourcefile.shp<br>
> *-sql* *"*SELECT Linha AS name FROM sourcefile*"*<br>
<br>
Pedro,<br>
<br>
The above SQL statement only selects one single field from the shapefile, so it<br>
is expected that the resulting GPX will have only the standard <name> attribute.<br>
You must explicitely list other fields in the SELECT clause if you want them to<br>
go in <extensions>.<br>
If you want to be quick and don't mind the Linha field to be in the extensions<br>
as well in addition to <name>, you can just do "SELECT Linha AS name, * FROM<br>
sourcefile"<br>
<br>
Best regards,<br>
<br>
Even<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a><br>
</font></span></blockquote></div><br></div>