Is there anything like http://jsonlint.com or http://geojsonlint.com for WKT? How can I validate a complex WKT string, say e.g. a Multipolygon?
Asked
Active
Viewed 9,113 times
6
-
possible duplicate of http://gis.stackexchange.com/questions/60534/are-there-any-online-wkt-editors See also: http://stackoverflow.com/questions/9985484/php-validate-wkt-values – Antonio Falciano Mar 18 '14 at 16:03
1 Answers
6
One possible WKT validator can be PostGIS or a whatever spatial DBMS you like. For instance:
SELECT ST_GeomFromText('POINT(-71.064544 42.28787)');
is executed successfully, because POINT(-71.064544 42.28787) is a valid WKT representation. Instead:
SELECT ST_GeomFromText('POINT(-71.064544, 42.28787)');
returns:
ERROR: parse error - invalid geometry HINT: "POINT(-71.064544, " <-- parse error at position 18 within geometry *** Error ***
ERROR: parse error - invalid geometry SQL state: XX000 Hint: "POINT(-71.064544, " <-- parse error at position 18 within geometry
because POINT(-71.064544, 42.28787) is not a valid WKT. Hope this helps.
Antonio Falciano
- 14,333
- 2
- 36
- 66
-
Not as easy as an online copy'n'paste tool but if one already has a PostGIS installation, then it works :) – nachtigall Mar 19 '14 at 10:45