I want to display a map that shows data points from my custom content type Places, filtered by a Taxonomy term Topic and proximity to the users location (using Global Filter). I would also like the data points to display a popup so that the user can click through to the node page for more detail.

I followed the Popups example and built a Views_GeoJSON Feed view and added its source to the map. This looks good, and popups and zoom to source work well. The Views_GeoJSON view responds to contextual filters as expected, but to date there is no way for the OL map to pass context info to the view.

I also took a different approach and built a Views Page display using the Openlayers map format. In this case, the contextual filters work as expected, though I have to change the Taxonomy filter settings depending upon how I choose to display the map. When I display the map at the Views Path URL, or in a block provided by OL, the Taxonomy term contextual filter settings that work are: When the Filter value is NOT in the URL > Provide default value > Raw value from URL. When I display the map inside a Panels pane on the /taxonomy/term page (my ultimate goal), the Taxonomy filter settings that work are: When the Filter value is NOT in the URL > Provide default value > Taxonomy term from URL and select Load default filter from term page. The Global Filter module provides a contextual filter for proximity when it is set up to work with the Geofield field, and this works very well. In this configuration, the map displays data points filtered properly, and will zoom to source, but Popups do not work and Tooltips display only a small, empty white square. There are no errors shown in the JS console. Popups don't work for me even with no contextual filters set.

I came to Openlayers several weeks ago because it was recommended by another mapping module as being more feature-rich. It's obvious that a lot of work has been done and that OL has lots of capability. I understand now that the rewrite to version 3 was forced by major changes upstream in the Openlayers library and that the documentation for OL3 is yet to be written. I was hoping to help with that and thought I could figure it out by poking all the buttons and pulling all the levers to see what they do, but I can't get this to work yet.

Please help if you have suggestions on how to get a map to display filtered and with popups.

Comments

sapiotech created an issue.

drett’s picture

I've just begun working with OL3 and have been coming across the exact same issues. I have two basic needs that aren't working for me: 1) to use Views Contextual Filters to dynamically create map pages and 2) to have fields from a View show up in pop-ups. I've enabled the Openlayers Examples module and it appears the popups and tooltips are working for maps with sources other than Views, so I imagine this is Views-related.

I would mention up front that in Views, I know to choose the "OpenLayers Map" format, then create an "OpenLayers Data" display and to map the fields in my View to the data, title, and description settings for the display. I am uncertain, however, about which display is doing the heavy lifting here, though, since both the page display and the "Data" display both use fields and the same set of mappings. (I don't think the "map" page display took fields in 7.x.-2.x., so it was less confusing.) I mention this in case it suggests I'm misconfiguring something. This is also relevant to the contextual filters question. Which display should have them? The page, the "Data," or both?

This set of needs had been working for me in a 7.x-2.x project. There is a lot I like about version 3 of the module, but these issues are major hangups for me. I spent a lot of time trying to upgrade from versions 2 to 3, so I'm hoping there is some solution I'm just missing.

Basically, I'm wondering 1) whether someone can confirm that popups are known not to work with Views data; 2) whether Context Filters are know not to work; or, 3) if anyone has some configuration suggestions that might help.

Also, I tried to use the Views Geojson feed instead of the data overlay, but according to https://www.drupal.org/node/2687291 and its related issues, that is a no-go for contextual filters.