I am using Drupal 7 and its version of Open Layers and have everything setup so it works. However, I have been trying to figure out how to set up an Open Layers Data Overlay view so it filters the data a specific way.
What I am trying to do is this I have a multiple nodes of 1 main content type and each node, of this type, has different locations. I want to filter and find close nodes of different types based off this main content types location. I was planning on using one view’s block on a page with the OL Map which would show the close nodes.
I thought I could set this up using the views contextual filter with the ‘Content:Nid’ which would select the current node and its location data. This is where I am not sure what to do next. I thought I could somehow use the ‘Proximity Filter : Great-circle’ with the Nid’s location to show all the other close by nodes. However, I have not been able to set this up and get this to work right. Any help, link, or video would help out a lot.
Comments
Comment #1
thechumley commentedAn approach might be to write a small module that implements hook_views_pre_render(). You could then get the current node's location and compare it to the location of the nodes returned in the $view->result. Any nodes with locations that are too far away can simply be removed from the result array.
The downside of this approach is that the view will need to return all possible locations in the result, so you will be querying for a lot of data that you won't always need. This may or may not be a problem in your scenario.
Comment #2
pol