Geolocating your content using Drupal

Thanks to Matt Burke from My Tunstall for these instructions.

If you want to Geolocate content posted on your Drupal site you will need a couple of modules
http://drupal.org/project/views Drupal Views
http://drupal.org/project/location Drupal Location

Drupal has a module called the “Location module”, a fantastic add on for the CMS, which allowed me to create a location based business directory on MyTunstall in hours, and the bespoke feed for Talkabout Local AR in about 5 minutes.

Basically the “location” module allows you to add location data to your posts, and will geo locate an entered address for you or allow you to drop a pin prick onto a map if address is unknown. This geo located data is stored away with your content for future use and an be presented in many ways.

Then using the Drupal Views module, a module that allows you to create lists from your content, I simply told it to create a RSS feed. Because Drupal is built on code hooks, the Location module is able to inject geolocated data into the rss output.

Screen Shots: (Adding/Editing a article).
I quickly added the location of the building in the following story, by clicking on the map, if I had an address with street name and postcode, I could also enter that if I didn’t know where to push the pin in and google would geo-locate the place for me.

http://mytunstall.co.uk/2012/10/tunstall-pool-and-now-plans-6-lane-25-meter-swimming-pool-down-plug-hole.html

Creating a View Screen Shots

Part 1. Setting up the basic view
Here I tell the view I need to show the title, and pull in the location fields. I set up some field filters so I only return published, articles with a geo-location, and set a sort by date created (descending).
If you are familiar with Drupal’s views, you’ll know you can set up pages (dedicated page with your lists contents), or blocks that can be reused around the website along side other content. For this instance, I need to make use of Views RSS output.
From here, set up some simple feed parameters
When you then view the rss feed, the combination of the views module and locations module just adds the geo-location into the feed.
And there you have it. http://mytunstall.co.uk/talkaboutar  the finished article.
Matt Burke, runs hyperlocal website MyTunstall by night and works for Drupal Developers Adaptive by day.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>