How to Store Addresses and Locations

In the good old Drupal 6 days, when you had to store an address and have that address converted into a latitude and longitude you would use the Location module. If you wanted to display a Google Map on your website, you would use the Gmap Module. In Drupal 7 the landscape has changed and now you have a lot more options than just using the Location module.

A lot of the functionality that the Location module gives you can be found in four separate modules: Address Field, Geofield, geoPHP and And Geocoder.

Address Field allows you to store postal address. Geofield allows you to store geographic data in a number of formats, like longitude and latitude. geoPHP provides Drupal integration with the geoPHP library. And Geocoder, this module is used to convert a postal address into geographic coordinates.

In this video I’ll show you how to setup the modules mentioned, to allow users to enter in an address and then have a map displaying the location of the address.

You may think that installing four modules to handle addresses and locations is a bit too much.

This method does give you some flexibility. Let’s say, for now, you only need to store addresses, but in the future you may want to store coordinates as well like longitude and latitude.

Then, just setup Address Field to handle addresses for now and Geofield later.

Modules

drush dl addressfield geofield geophp geocoder ctools

Resoures