Synchonize list of locations currently visible on the screen

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
grubshka_v2's picture

Hi there,

I tested different mapping modules, and loved IP Geolocation Views & Maps, but I can use another one if I manage to do everything I need :-).

I'm making a website for a movie production association.
I need to show different projections of the movie, so I made nodes for projection rooms, and node for projections (maybe they'll become entities, but that's not the point here).

I made a map with my projections, grouped by projection rooms, and the list aside. I also partly managed to detect user location, and center the map on it, with a default radius.

I'm stucked on two problems :

  1. When the user loads the page, I geolocalize and center the map on him, with a default radius. Here, i'd like to adjust the zoom to show a minimum 3 projections, in a maximum radius of 20 kilometers. If none is found in this radius, I'd like to show a message to invite him to organize one.

  2. I'd like to show the list of visible locations aside the map, I mean only the locations the user is actually seeing, and keep it synchonized the the zoom/center of the map changes.

I can do this in the code if necessary, I just need a starting point !

Regards,

--
Pierre

Comments

Requires custom code

RdeBoer's picture

These are rather specific requirements. So you'll have to use some custom code.
Here are some building blocks provided by existing modules.

o Centering the map.
IPGV&M, http://drupal.org/project/ip_geoloc, allows you to center the map on the visitor, and version IPGV&M 7.x-1.x dev will also optionally draw an "accuracy" circle around that location. The map is auto-zoomed to contain all the markers output by the View given the (exposed) filter settings of the View (see next point).

o Proximity filtering, i.e. only show nodes within 5, 10, 20 km of user.
When you use Geofield, http://drupal.org/project/geofield in combination with Views Geofield adds to the Views field, filter and sort handlers for proximity. The proximity is w.r.t to a source/reference point and when using IPGV&M that reference point can be set to the location of the viewing user (see above).

o Synchronisation of map and list/table of nodes shown left, right, below or above the map
Using the Views UI, copy the master View (which you have configured as a map) as an Attachment or Block display and then change its display format to Table. Make sure that the table Inherits the (exposed) filters of the map, so that they sync in what they're outputting.

o Then using the "cross-highlighting" feature of IPGV&M, when you hover over a row in the table the corresponding marker on the map highlights and vice versa.

There is an example that does all of the above here: http://regionbound.com/coffee-prices-across-melbourne. Hover over the blue information buttons to learn more. On that page there is also a link to the Drupal configuration screens.

Those messages you talk about you'll have to add via your own custom module.

Thanks for your quick answer

grubshka_v2's picture

Thanks for your quick answer Rik.

I already made points 1 to 3 working, with the documentation and some tutorials found on the web. I'm sad I didn't find the configuration screens of the regionbound.com website earlier...
Region Bound is a really amazing feature, I'll try it right now !
I didn't know about the cross-highlighting feature, thanks for mentioning it, it's one of the feature I need.

Concerning the synchronization, I need to show the list of locations the user sees on his screen, not the whole list of the map locations, like this : http://enquetedesens-lefilm.com/projections/ (it's not really easy to use, that's why I'm remaking it, but if you manage to zoom and then move somewhere on the map, you'll see the list on the right updated).
But I'll take a look to the Javascript Leaflet API later, I hope to find some interesting things there.

Location and Mapping

Group organizers

Group categories

Wiki type

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week