Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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,
m.
Comments
Comment #1
tmcw CreditAttribution: tmcw commentedYou'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.
Comment #2
tmcw CreditAttribution: tmcw commentedAny luck on implementing this?
Comment #3
tmcw CreditAttribution: tmcw commentedClosing; works as designed here, no response.
Comment #4
Exploratus CreditAttribution: Exploratus commentedThe 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.
Comment #5
svanou CreditAttribution: svanou commentedDid you manage to get this integrated with view already ? If so, can you please help me to achieve this ? Thanks ! Sylvain
Comment #6
bloomt CreditAttribution: bloomt commentedI would also like to know how people have accomplished this.