Bug report #16217

fromWkt should accept any whitespace

Added by Mike Taves over 3 years ago. Updated almost 3 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Unknown
Affected QGIS version:2.18.3 Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:24127

Description

This bug was discovered with the QuickWKT plug-in with copy/paste from Excel, which uses tabs delimiters when pasting into a text window. For example, "POINT (180398 5459331)", where the whitespace in between the two values is a tab character, is considered by the QGIS WKT parser as invalid (it is not).

From a QGIS Python console:

# With space, there are no problems
geom = QgsGeometry.fromWkt("POINT (180398 5459331)")
print(geom is not None)  # True
# With tab, it does not read the WKT
geom = QgsGeometry.fromWkt("POINT (180398\\t5459331)")
print(geom is not None)  # False

Most other WKT parsers (PostGIS, GEOS, etc.) are more relaxed, and handle any whitespace without issue

(E.g. "SELECT ST_AsEWKT(E'SRID = 123;\
\
POINT\
(1\\t\
3)'::geometry);" works)

Associated revisions

Revision b29a8d0c
Added by Nyall Dawson over 3 years ago

Accept any whitespace delimiters when parsing WKT (fix #16217)

Revision 5bbdb1f1
Added by Nyall Dawson over 3 years ago

Merge pull request #4178 from nyalldawson/fix_16217

Accept any whitespace delimiters when parsing WKT (fix #16217)

History

#1 Updated by Nyall Dawson over 3 years ago

  • Status changed from Open to Closed

#2 Updated by Jürgen Fischer almost 3 years ago

  • Category set to Unknown

Also available in: Atom PDF