Well-known text

Is used to obtain the vector layers of API maps based on their description in WKT format.

DG.Wkt

Example of usage

Reads the description of the polygon in WKT format and displays it on the map:

var polygonComponents = 'POLYGON((82.91699 55.042136, 82.917522 55.040187, 82.918063 55.040235, 82.917540 55.042184,82.91699 55.042136))';
DG.Wkt.geoJsonLayer(polygonComponents).addTo(map);

Methods

Method Returns Description
DG.Wkt.toGeoJSON( <String> wkt) geoJSON Reads a string in WKT format and verifies its correctness. Returns GeoJSON.
DG.Wkt.toLatLngs( <String | Array> wkt) Array Reads a string in WKT format and returns the pixel array in the LatLng format (its internal representation). Can take an array of WKT strings.
DG.Wkt.geoJsonLayer( <String> wkt, <GeoJSON options> options?) Object Creates a GeoJSON layer. Takes a string in WKT format to display the data on the map and the object of options. Generates a vector layer of maps AP based on the data read with the DG.Wkt.toGeoJSON method. This method supports all the options of the constructor of the DG.GeoJSON class. For example, you can send the DG.Wkt.geoJsonLayer(polygonComponents, {clickable:false}) parameter, to make the layer non-clickable.