Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Earlier, we used address book entries as an example of a simple data structure, but an address has actually two kinds of information. It's the numbers and letters that define it, and the actual place that it defines on a map. That second kind of locational information moves an address into an area of geographic data that's highly valuable in ways that can affect lives directly. That was the case in the 1854 cholera outbreak in London, which Edward Tufte made famous in his 1983 book, 'The Visual Display of Quantitative Information.' People throughout that city were dying, but nobody could figure out why, until Sewer engineer Edmund Cooper and later the Dr. John Snow, decided to plot the deaths on a map.
Obvious patterns became clear immediately and the cause was pinpointed to a specific water pump that the victims used. So that's the background in an understanding of how this information can be especially useful, but let's get back to Drupal. We showed some Drupal sites that turned data into maps and the video touring examples of data presentation. This video shows how Drupal turns street addresses into points that can be plotted on a map, while two other videos explain how to use the location and the GMap modules to plot those points. I should mention that some of these mapping examples that I'm showing you right now were actually created using a different pair of modules, called Geo and Nice Map, but the fundamentals are still the same. Here's how it works.
The earth is divided into an imaginary grid formed by lines of latitude, which is north and south, and longitude, which is east and west. When you have two coordinates, one for latitude and one for longitude, it's a simple matter of math to plot the exact location that they describe on a globe. But first you have to turn that location data, such as, a street address, into those two points. That's a process that's known as Geocoding. There are several options for online Geocoding. The best known is Google Maps at Maps. Google.com. There are also other sources, such as, those from Yahoo and the US government. But we're going to focus on Google Maps, because it's currently the easiest and fastest way to get started mapping locations in Drupal.
Here is how locations get geocoded in a very simple example. Let's take an address. 1 South Main Street, Oberlin, Ohio. And there we go, we see the location, but where exactly is that in latitude and longitude? To find out, click the Link button here and then copy the link that it gives you. I'm going to put that link into a Text Editor, and then break it up a little bit so that you can see where the latitude and longitude information is. I'll switch over my Text Editor. Here I'll paste that link into the Text Editor and then find the Ampersand and Return it. Very good. Here you can see your latitude and longitude as 41.292157 and -82. 217388. So Google Maps has geocoded that address.
However, that's only a very limited use, because it's a single address. What if you wanted many addresses geocoded through your own Drupal site rather than having to go to Google site? Fortunately, Google permits that in a limited way through its Application Programming Interface or API. On the Google Maps API page, if you click on Docs, you can learn all about how to integrate Google Maps into whatever program you're designing. The good news is there are already modules written that will integrate this API into Drupal, so you don't have to know exactly how the API works. You just have to be able to give it an address and Google Maps will turn that into the latitude and longitude you need, and place that point on a map.
I think mapping is an incredibly valuable kind of data presentation form to add to your site, because it becomes so much clearer when you see things on a map. Mapping, in general, is a big subject and we're only going to scratch the surface by showing you the fastest way to implement maps in Drupal. There are some mapping tasks that the GMap module can't fulfill though. For example, it forces you to display maps in their format and color scheme. So those unusual graphic styles we saw on some of our examples, required another solution. They, in fact, use the different pair of modules as I mentioned, Geo and Nice Map, which are amazing. But as I record this video, they're unfortunately not quite ready for public use. They maybe, by the time you see this video, however, and maybe worth looking up.
As always, your best source for information that will take you beyond what you learned here is Drupal.org, and specifically, the mapping discussion group at Groups.Drupal.org/Mapping.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.