2

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
asked Feb 23, 2015 at 18:36

1 Answer 1

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.