[OpenLayers-Users] geometry intersection in different layers

Andreas Hocevar ahocevar at opengeo.org
Sun Oct 18 19:30:46 EDT 2009


Genís Pujol Hamelink wrote:
> Hello list,
>
> Is it possible to check if two lines in different layers intersect?

That shouldn't be a problem. Assuming your layers are called layer1 and 
layer2, an you want to intersect layer1's feature #12 with layer2's 
feature #23, you could do the following:

g1 = layer1.features[12].geometry;
g2 = layer2.features[23].geometry;
var intersects = g1.intersects(g2);

Regards,
Andreas.

>
> greetings,
>
> -- 
> Genís
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list