Mapping notes


A Drush commandis at the end of the article which downloads all of the main modules used in this screencast.
Transcript Below:

In this screencast, I'm going to demonstrate how to build mobile friendly maps that are driven from data in Drupal entities.

This map is a prototype I built for mapping Alzheimer clinics.

It is built using Leaflet and the Marker Cluster module, so the icons are grouped when they are close together. This makes it easy to navigate using a touchscreen.

The information in the popups comes directly from fields in a view and so are easily customized.

The information that is entered in the location field is parsed by google and so many different address formats will work.

Inspecting the content type shows that we have a Postal Address field and a Geofield. The geofield stores latitude and longitude and is set to get it's information from the Postal Address field, using Google geocoding service. Many other geocoding services can be used simply by changing a selectlist value on the field settings form.

In the view, we change the format to Map using Leaflet API, via IPGV&M, short for the IP Geolocation Views and Maps module.

The Slide with Style combined with the Views Contextual Range Filter module can be used to make slider widgets for filters, but I haven't tried that yet.

With the default setup, visitors are prompted to confirm sharing of their location. Turn this off, according to the module page on Drupal.org, by "unticking the box Employ the Google Maps API to reverse-geocode lat/long coordinates to street addresses, which is on the page Configuration >> IP Geolocation Views and Maps. With the box unticked, IPGV&M will no longer ask for lat/long to determine the browser location and instead use the far less accurate position location method based on IP address. This IP lookup will employ either the Smart IP or GeoIP API modules, depending on which one you have installed."

People have said that Leaflet can get you 90% of the way 90% of the time; for the rest there is Open Layers.

Modules used:
Geophp - required by some of the below modules
Geofield - 7.x.2.x
Addressfield + geocoder
Views
IP Geolocation Views and Maps (ip_geoloc)
Leaflet
Leaflet More Maps
Leaflet markerCluster

Other modules mentioned:
Slide with Style and Views Contextual Range Filter

Drush command to get all dev releases of the mapping modules used in this screencast:

drush dl geophp geofield addressfield geocoder ip_geoloc leaflet leaflet_more_maps‎ leaflet_markercluster --dev
‎

Tags

Internal References

Article Type

General