I'm trying to implement an a map that returns the coordinates clicked by the user, as well as the region. It means that I need to know if the point is included in a polygon (the region).

I found that openlayers implement "containsPoint" function, but I didn't find how to do this with openlayers module or drupal (without geo module, as far as my hosting don't let us use the spatial extensions).

Is openlayers module ready for this query? If not, could you drive me to the right direction?

Thanks a lot in advance,



tmcw’s picture

You'll need to write the code to do this, as you would have to otherwise, but you'll need to wrap it in a behavior here - look at the existing behaviors in the module for examples of how to do this.

Are you checking whether point clicked by the user hits a vector-rendered polygon? If so, you might be better off using a preexisting OpenLayers behavior like Handler.Click, rather than iterating through all polygons to determine the one clicked.

tmcw’s picture

Status:Active» Postponed (maintainer needs more info)

Any luck on implementing this?

tmcw’s picture

Status:Postponed (maintainer needs more info)» Closed (works as designed)

Closing; works as designed here, no response.

Exploratus’s picture

Component:OpenLayers API» OL API

The Views JSON Module allows you to set a bounding box on a map and show nodes within that bounding box. I believe it will not allow you to have a node with a polygon and show nodes within that though.

svanou’s picture

Did you manage to get this integrated with view already ? If so, can you please help me to achieve this ? Thanks ! Sylvain