Location finder with zero coding using Drupal location, gmap and views modules

Location finder with zero coding using Drupal location, gmap and views modules

Submitted by Jitesh Doshi on Sat, 06/13/2015 - 12:36
Drupal Location Finder

Drupal is a such a powerful and mature platform that you can build a full featured location finder (e.g. Store Locator) with zero coding, with judicious configuration and some fantastic contrib modules.

Here's a rundown of the features:

  • A very flexible Store Location content type with any number and types of custom fields (such as service offered, store hours etc.)
  • Import any number of store locations — along with custom fields — from a CSV file.
  • Automatically geocode (assign latitude & longitude) the locations based on the address entered.
  • A search form and result listing (a Drupal views view with an exposed form) that shows matching locations.
  • The user can enter their zip code and see the distance of the location from their zipcode. And also sort based on distance.
  • Show all matching locations on an interactive map.

So, let's get started.

  1. Install and configure the location module. It provides a special "location" field type that not only holds an address, but also holds geographical coordinates (latitude & longitude). It also has capability to convert an address into lat/long. As of this writing, you must use the 7.x-3.x-dev version of the module, and not the recommended release, because of a serious bug.
  2. Create a content type for Store Location, including the custom fields relevant to your business.
  3. Download this CSV file from here and unzip it.
  4. Create a feeds importer to import the CSV file rows as Store Location nodes. Don't forget to add the location_feeds module.
  5. Create a view with "page" display, a "gmap" attachment display, and an exposed filter to enter the zipcode.
  6. Finally, package the whole setup as a feature.

Jitesh Doshi

Profile picture for user Jitesh Doshi
Managing Partner & CTO
  • A seasoned technology entrepreneur and enthusiast
  • A regular speaker at industry conferences and universities
  • Host and organizer of technology user groups
  • Active in management of non-profit organizations serving the local community
  • Leader and contributor for multiple open-source projects
  • Expert in cloud, application integration, web and mobile technologies
  • Author of open-source projects, including on Drupal.org - Popular Tags and PRLP.
  • Developed several highly successful software platforms and frameworks for clients
© 2023 SpinSpire All rights reserved.