DEV Community

StuartCreed
StuartCreed

Posted on • Updated on

Converting a shape to a Well Known Format with OpenLayers

To convert a feature in a Well Known Format (https://en.m.wikipedia.org/wiki/Well-known_text_representation_of_geometry) -> useful for CQLFILTER request HEADERS.

const wktFormat = new ol.format.WKT();
const polyCoords = [];
this.features.forEach(feature => {
polyCoords.push(wktFormat.writeGeometry(feature.fixLastPoint().getGeometry()));
})

Top comments (0)