Hello. I would like to show nearby nodes on a map when viewing a node. I have a content type called Location that has a Geolocation field contain lat/lon coordinates.

1. So I create a view, using Leaflet CommonMap, showing content of type Location, with the Coords field used as the source for map coordinates.
2. I create a Contextual Filter, default value coming from the node ID.

This gives me one location.

3. I add Proximity to the Filters, but I have to have a distance from one point to another. I don't know how to configure the distance from the node selected in step 2 above and the other nodes.

4. I read this:
https://medium.com/@rikdeboer/new-ways-to-display-related-content-with-v...

and installed the module Contextual_Range_Filter, which looks very promising, but without much documentation.

I think this would be a helpful feature for many Drupal sites, to display a map of a site and nearby sites on the same map.

Thanks in advance.

Comments

timkroehler created an issue. See original summary.

christianadamski’s picture

Status: Active » Closed (works as designed)

I think this already works. There is a "Proximity by Entity ID" VIews Argument available. You can go to simplytest.me, enable geolocation and the geolocation_demo module and then go to geolocation-demo/proximity-by-entity-id.

Then add an ID like geolocation-demo/proximity-by-entity-id/32, it gives you nodes sorted by proximity to node 32.

You can take a look at the view to see how it's done.