Last updated 4 December 2013. Created on 15 June 2012.
Edited by boragunesdogan, inkling, nicoz, ifrik. Log in to edit this page.

Openlayers Locator is a feature module that sets up the basic functionality for a map based proximity search. It creates a content type "Location"; a view to list all these locations, a map and the search option; as well as a link to it in the main menu.

This is a screenshot of an example proximity search results.

Example proximity list

Installing and enabling the required modules

  • Install all required modules listed on the Openlayers Locator project page.
  • Enable the Openlayers Proximity feature module either from the modules admin page (admin/modules) or the features admin page (admin/structure/features).

Once the feature is enabled, a new content type and the proximity search view are created and configured for you.

Example use

Create geolocated content

  1. Go to the 'add content' page and choose to create a new Location.
  2. You will find the usual title and body fields plus an address field set, fill it in and save.
  3. If the geolocator module was able to geolocate your address it will be shown in a map in the node page.
  4. Add several more Location nodes (choose near-by addresses so you can find several of them within a few kilometers range.

Conduct a proximity search

  1. You will find a Locator menu item on your primary menu: click on it.
  2. You will find all your nodes la new conteisted and a proximity search box.
  3. Type in the city name (it does seem to work better with city names than postal codes, at least for Spain) and click search.

If some nodes are within your range, you should see a table and a map with the corresponding results.

What is this feature doing?

Go to admin/structure/features and click on the link for the OpenLayers Locator feature. It will show all the dependencies enabled on the left side and the views and content types on the right.

This feature provides:

  • The Location content type: ol_locator_location: This is the content type which is configured to store your location based on an address. It uses geofield, geocoder and addressfield modules for that purpose. You can learn more about how to configure this three modules together in the Getting Started with OpenLayers in Drupal 7 guide.
  • The node view OpenLayer map: ol_locator_node_map: You will find this is the OpenLayer map in your Location node view pages. It is configured as the format widget for the geofield module in the Location content type (have a look at admin/structure/types/manage/ol-locator-location/display)
  • The search OpenLayer map: ol_locator_proximity_search_map: This is the OpenLayers map that shows your nodes in the search results. It is used by the search view (see below).
  • The search view: ol_locator_proximity_search: This is the view page where all the fun happens. It basically uses the OpenLayer search map (see above) for the display and an exposed filter provided by the OpenLayers proximity module to filter out the nodes outside your range.
  • The table is an attached display.

Looking for support? Visit the forums, or join #drupal-support in IRC.