[Qgis-user] save layer as with OGR2OGR options

Bo Victor Thomsen bo.victor.thomsen at gmail.com
Mon Feb 16 21:06:03 PST 2015


AFAIK the "data" and "layer" option box in the "Save As" dialog only 
handles -dcso and -lco options for ogr. So the -sql .... won't work.

One option is to create "virtual fields" in QGIS with the correct field 
names "name", "cmt" ... and give these virtual fields the relevant content.
However the export to gpx will fail if you specify 
-gpx_use_extensions=*no*, because the original field names doesn't fit 
the schema definition for GPX. This will cause an error message and the 
data won't be created

To sum it up:

 1. Use virtual fields in QGIS to create fields and values that's
    acceptable for GPX
 2. use_gpx_extension has to be set to "yes"
 3. Remember to save your GPX data in the EPSG:4326 projection (ll/wgs84)

Regards

Bo Victor Thomsen
AestasGIS
Denmark

Den 16-02-2015 kl. 17:54 skrev Julien_Guilloux:

> Hi list,
> i already read a lot of post about exporting layer in another format using
> "save as " windows of QGIS with adding ogr2ogr options (in data source box
> or layer box down the windows).
>
> the trouble is the same that a lot of people : i "only" want to export a
> layer shape in a layer GPX
>
> 1) of course i could only use GPX_USE_EXTENSIONS  = YES and all my fields
> would go into the <extension>
>   xml;
> But... it is not what i need. i really need to have the fields "name" and
> "cmt" as they exist in the real gpx structure !
>
> 2) so, how to rename my field "testfield" to a field called "name" so as to
> respect GPX syntax ?
>
> in the data source option i try many many many syntaxe :
>
> -sql "SELECT testfield AS name FROM testlayer" (this is ogr2ogr
> documentation...)
> -sql "SELECT testfield AS name"
> sql "SELECT testfield AS name FROM testlayer"
> "SELECT testfield AS name FROM testlayer"
> 'SELECT testfield AS name FROM testlayer'
>
> Etc... But it never works !
>
> i also try some syntaxe using the -dsco option but no more succes !
>
> so, is it possible to use ogr2 ogr option ?
>
> another thing : there use to be a samll GPX plugin to do that, we could
> choose the field for name etc. ( i don't talk about gps extension with
> gpsbabel)
> is this plugin still exist ? theis plugin in was made with ogr2ogr i think,
> so what not to use ogr2org option directly ans asked here ?
>
> thanks a lot.
>
>
> Thanks for helping. So long
>
>
>
>
>
> --
> View this message in context: http://osgeo-org.1560.x6.nabble.com/save-layer-as-with-OGR2OGR-options-tp5187941.html
> Sent from the Quantum GIS - User mailing list archive at Nabble.com.
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20150217/c5350019/attachment.html>


More information about the Qgis-user mailing list