[GIS] Well-known text (wkt) validator

validationwell-known-text

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?

Best Answer

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.

Related Question