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?

up vote 5 down vote accepted

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.

  • 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

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.