Drupal views - CiviCRM Contact Distance Search - with a map!

2018-05-30 03:46
Written by

Drupal module - CiviCRM Contact Distance Search

MillerTech released this Drupal module back in 2015 but have recently updated with new features (map and use your location) and to make it more configurable.

This module offers a fully configurable/extendable Drupal view that provides the functionality to search from a postcode and a distance.

Use case scenario – Find schools from my postcode within a 5 mile radius.

With the example above you would have schools as contacts in your CiviCRM database with a primary address and both the latitude and longitude fields should be populated.

The Drupal view that’s shipped with this module can be configured to filter on a particular contact subtype i.e. schools.

Search results will provide you with schools within a 5 mile radius of the entered postcode along with distance.

Distance is calculated by road (or as the road winds or as the crow walks etc.) and NOT as the crow flies.

New features includes an option to display a map –

And also an option for your device to use your location which will populate the postcode field (works best with mobile devices for accuracy) –

CiviCRM extension page - https://civicrm.org/extensions/civicrm-contact-distance-search

Full installation steps available on the Drupal module page - https://www.drupal.org/project/civicrm_contact_distance_search


Filed under


Cool but what are the advantages over using https://www.drupal.org/project/ip_geoloc ? I use that to e.g. create this view for a CiviCON 2015 presentation on Payment Processing - mostly to show how far Eileen had to travel to get to Denver:



I’m unfamiliar with the IP Geolocation module and after a brief read it looks very powerful.

In terms of advantages, the CiviCRM contact distance search module has been designed to work with CiviCRM and its longitude and latitude fields.  

If your CiviCRM installation is with Drupal then upon installation of this module, minimal effort and configuration is required for it to work.

All you need to do with IP Geolocation module is -> add the CiviCRM Address: Latitude and CiviCRM Address: Longitude as fields in your View; and then hit settings Format: Map (Leaflet) to say that you want IP Geolocate to use the CiviCRM Latitude for Latitude and CiviCRM Longitude for Longitude. That's it - it's a 5min config ( I wrote it up here: https://civicrm.stackexchange.com/questions/12862/how-to-put-your-civicrm-contacts-on-a-leafleft-map-in-5min ); Leaflet maps are cool; responsive and you can even customize your map markers (colours, font-awesome icons) based on any CiviCRM data - even based on custom field values;

Is there a way to search proximity of CiviContacts from one's current location with the IP Geolocation module?

Am I correct that this will only with for Google API geocoding?