[Qgis-user] field calculator: geomToWTK

Alex Mandel tech_dev at wildintellect.com
Tue Apr 8 11:06:34 PDT 2014


On 04/08/2014 09:35 AM, Bernd Vogelgesang wrote:
> Hi,
> I found it the fastest way to use the geomtoWTK function in the field
> calculator to export the geometry of a polygon layer to a text field
> (geomToWTK($geometry)), join it to a database table (dbf), export it as
> csv and then have a new layer (many database entries for one geometry,
> resulting in duplicate geometries) imported with Delimited Text Layer.
> 
> This worked fione and fast for one task, but now I have way too long WTK
> to store it in a text field.
> 
> One reason for this is, that the precision of the exported nodes is 17
> digits, which bloates the hole string. For my task zero precision would
> be sufficient.
> Example:
> POLYGON((4440571.01020000036805868 5572180,4440570.52076516300439835
> 5572176.90983005613088608,4440569.1003699442371726 ...))
> 
> Question: Is there a way to influece the output of the WTK, so I have
> zero digits precision?
> or
> Can anyone recommend another workflow?
> 
> Cheers
> Bernd

Spatialite http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.1.0.html
asWKT takes a precision value
AsWKT( geom Geometry [ , precision Integer ] ) : String

Spatialite and Postgis tables probably also allow for larger data storage.

Also this export would be moot if you use a database. Since you can do a
one to many self join as a query all in one step.


Thanks,
Alex



More information about the Qgis-user mailing list