[Qgis-user] wkt multipoint via delimited text requires internal parens
Andreas Plesch
andreasplesch at netscape.net
Wed Jul 12 07:05:00 PDT 2017
Hi, I could narrow down the error to negative coordinates:
This works on the console:
>>> QgsGeometry.fromWkt('MULTIPOINTZ(2 2 4,3 3 4)').exportToWkt()
u'MultiPointZ ((2 2 4),(3 3 4))'
But this does not:
>>> QgsGeometry.fromWkt('MULTIPOINTZ(-2 2 4,3 3 4)').exportToWkt()
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'exportToWkt'
So negative coordinates do not work without parentheses, surprisingly.
Perhaps some oversight in parsing.
But negative coordinates work with parentheses:
>>> QgsGeometry.fromWkt('MULTIPOINTZ((-2 2 4),(3 3 4))').exportToWkt()
u'MultiPointZ ((-2 2 4),(3 3 4))'
If there are no objections, I will file a report on the bug tracker.
-Andreas
On Tue, Jul 11, 2017 at 7:09 PM, Andreas Plesch <andreasplesch at netscape.net>
wrote:
> Hi
>
> Using 2.18.3, I found that Add Delimited Text Layer required a WKT of the
> form:
>
> MULTIPOINT Z ((-119.00 34.82 1487),(-119.01 34.81 1450))
>
> rather than just
>
> MULTIPOINT Z (-119.00 34.82 1487,-119.01 34.81 1450)
>
> without the internal parentheses which is also allowed, and perhaps more
> common.
>
> I searched through the bug tracker for 'MULTIPOINT' but could not find a
> relevant issue.
>
> Did anybody come across this ?
>
> On a related note, I did this in order to convert a LINESTRINGZ to POINTZ
> since the Extract Nodes tool did not preserve Z. CSV Exporting, text
> editing and reimporting as MULTIPOINTZ seemed the easiest option. Is there
> another option ?
>
> Thanks, Andreas
>
> --
> Andreas Plesch
> 39 Barbara Rd.
> Waltham, MA 02453
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20170712/30945c6c/attachment.html>
More information about the Qgis-user
mailing list