Thanks Christopher
By the time I got your reply I had already written my own function, but it
is based on the assumption that the features will always be Linear Rings
(they should be in my case), but I'm sure your function is a lot more
roubust.
function PolygonFromWKT(wkt) {
if (wkt.substring(0, 7) == "POLYGON") {
var geomLR = new OpenLayers.Geometry.LinearRing;
var aPts = wkt.substring(9, wkt.length - 2).split(', ');
for (var pt = 0; pt < aPts.length; pt++) {
var aPt = aPts[pt].split(' ');
var geomPt = new OpenLayers.Geometry.Point(aPt[0], aPt[1]);
geomLR.addComponent(geomPt);
}
return geomLR;
}
return '';
}
--
View this message in context:
http://n2.nabble.com/Adding-a-vector-feature-from-WKT-tp2238031p2238792.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users