The io/wkt module

>> var parser = require("geoscript/io/wkt");

Methods

read()
Arguments
  • wktString The Well-Known Text representation of a geometry.

Returns

geom.Geometry()

Create a geometry from WKT. The specific geometry type depends on the given WKT.

Example use:

>> var parser = require("geoscript/io/wkt");
>> var Point = require("geoscript/geom").Point;
>> var point = parser.read("POINT(1 2)");
>> point instanceof Point
true
write()
Arguments
Returns

String The Well-Known Text representation of a geometry.

Generate a Well-Known Text string from a geometry.

Example use:

>> var parser = require("geoscript/io/wkt");
>> var Point = require("geoscript/geom").Point;
>> var str = parser.write(Point([1, 2]));
>> str
POINT (1 2)