[Qgis-developer] WktExport plugin for QGIS
Even Rouault
even.rouault at spatialys.com
Tue Aug 25 07:28:07 PDT 2015
Le mardi 25 août 2015 16:22:13, Geo DrinX a écrit :
> Side remark. Your plugin probably makes it a bit more convenient, but you
>
> > can
> > already get the geometries in WKT format with "Save as", select CSV and
> > enter
> > GEOMETRY=AS_WKT as layer creation option (cf
> > http://www.gdal.org/drv_csv.html)
>
> Touche' , Even :)
>
> I do not know that is possible to do the same with save as... :(
>
> BTW, great ! There is some documentation for this ? I will browse
> QGIS manuals.
>
> Sure, my method is more immediate, and more convenient for my own use.
> For the rest of the world, I agree with you : a generic user, can use
> "Save as..." CSV and enter "GEOM=ASWKT"
> and... it does not work ! What is the correct syntax ? I do not
> remember: I need to try again... perhaps: "GEOMETRY=ASWKT". No, it do
> not work again... etcetera.
Indeed, the good news is that with GDAL 2.0, OGR drivers now have metadata. So
instead/in addition of a free text zone, the list of options could now
potentially be automatically generated by inspecting driver metadata
$ ogrinfo --format csv
Format Details:
Short Name: CSV
Long Name: Comma Separated Value (.csv)
Supports: Vector
Extension: csv
Help Topic: drv_csv.html
Supports: Open() - Open existing dataset.
Supports: Create() - Create writeable dataset.
Supports: Virtual IO - eg. /vsimem/
Creation Field Datatypes: Integer Integer64 Real String Date DateTime Time
<CreationOptionList>
<Option name="GEOMETRY" type="string-select" description="how to encode
geometry fields">
<Value>AS_WKT</Value>
</Option>
</CreationOptionList>
<LayerCreationOptionList>
<Option name="SEPARATOR" type="string-select" description="field separator"
default="COMMA">
<Value>COMMA</Value>
<Value>SEMICOLON</Value>
<Value>TAB</Value>
<Value>SPACE</Value>
</Option>
<Option name="LINEFORMAT" type="string-select" description="end-of-line
sequence" default="LF">
<Value>CRLF</Value>
<Value>LF</Value>
</Option>
<Option name="GEOMETRY" type="string-select" description="how to encode
geometry fields">
<Value>AS_WKT</Value>
<Value>AS_XYZ</Value>
<Value>AS_XY</Value>
<Value>AS_YX</Value>
</Option>
<Option name="CREATE_CSVT" type="boolean" description="whether to create a
.csvt file" default="NO" />
<Option name="WRITE_BOM" type="boolean" description="whether to write a
UTF-8 BOM prefix" default="NO" />
<Option name="GEOMETRY_NAME" type="string" description="Name of geometry
column. Only used if GEOMETRY=AS_WKT" default="WKT" />
</LayerCreationOptionList>
<OpenOptionList>
<Option name="MERGE_SEPARATOR" type="boolean" description="whether to merge
consecutive separators" default="NO" />
<Option name="AUTODETECT_TYPE" type="boolean" description="whether to guess
data type from first bytes of the file" default="NO" />
<Option name="KEEP_SOURCE_COLUMNS" type="boolean" description="whether to
add original columns whose guessed data type is not String. Only used if
AUTODETECT_TYPE=YES" default="NO" />
<Option name="AUTODETECT_WIDTH" type="string-select" description="whether to
auto-detect width/precision. Only used if AUTODETECT_TYPE=YES" default="NO">
<Value>YES</Value>
<Value>NO</Value>
<Value>STRING_ONLY</Value>
</Option>
<Option name="AUTODETECT_SIZE_LIMIT" type="int" description="number of bytes
to inspect for auto-detection of data type. Only used if AUTODETECT_TYPE=YES"
default="1000000" />
<Option name="QUOTED_FIELDS_AS_STRING" type="boolean" description="Only used
if AUTODETECT_TYPE=YES. Whether to enforce quoted fields as string fields."
default="NO" />
<Option name="X_POSSIBLE_NAMES" type="string" description="Comma separated
list of possible names for X/longitude coordinate of a point." />
<Option name="Y_POSSIBLE_NAMES" type="string" description="Comma separated
list of possible names for Y/latitude coordinate of a point." />
<Option name="Z_POSSIBLE_NAMES" type="string" description="Comma separated
list of possible names for Z/elevation coordinate of a point." />
<Option name="GEOM_POSSIBLE_NAMES" type="string" description="Comma
separated list of possible names for geometry columns." default="WKT" />
<Option name="KEEP_GEOM_COLUMNS" type="boolean" description="whether to add
original x/y/geometry columns as regular fields." default="YES" />
<Option name="HEADERS" type="string-select" description="Whether the first
line of the file contains column names or not" default="AUTO">
<Value>YES</Value>
<Value>NO</Value>
<Value>AUTO</Value>
</Option>
</OpenOptionList>
>
> :)
>
> Yes, I think my plugin can be useful to all of us "QGIS dummies" :)
>
> If you think, I can insert a message that explains: "You can also use
> 'Save as... CSV GEOMETRY=AS_WKT'
>
> :)
>
> Of course, I am joking.
>
>
> Happy holidays
>
>
> Roberto
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the Qgis-developer
mailing list