[GIS] openlayers extent intersects is not working properly

extentsintersectopenlayers

I am using

ol.extent.intersects(extent1, extent2) 

to check for intersection between layers and polygon I drew, but it doesn't get me any intersection which is weird because I draw the polygon creating intersection with the layer

can you think of any reason of this please ?

Best Answer

The reason was that the projection of the vector and the projection of the polygons drawn are different. To check for intersection, the projection for the vector and the polygons should be the same.