I wonder if someone here have a JavaScript function that when I draw a polygon I can see if I am drawing on another polygon?
like intersect... if polygon intersect say to me a alert...
using OpenLayers.
nmtoken
13.6k5 gold badges39 silver badges91 bronze badges
1 Answer 1
You can have a look at the intersection example of OpenLayers: http://dev.openlayers.org/examples/intersects.html
for(var i=0; i<features.length-1; ++i)
{
feat1 = features[i];
for(var j=i+1; j<features.length; ++j)
{
feat2 = features[j];
intersects12 = feat1.geometry.intersects(feat2.geometry);
if(intersects12)
{
alert("Intersection");
}
}
}
answered Feb 24, 2015 at 9:35
Explore related questions
See similar questions with these tags.
lang-js