SlideShare a Scribd company logo
Geolocation in Drupal (nodes & users) By Andrew M. Riley Mediacurrent Consultant @andrewmriley
Goal Introduce users to basic mapping concepts, OpenLayers configuration in Drupal and Geocoding users based off of IP address or device location. Disclaimer: Getting fancy may require some type of programming knowledge.
Mapping in General  
  GIS A geographic information system, geographical information science, or geospatial information studies is a system designed to capture, store, manipulate, analyze, manage, and present all types of geographically referenced data. In the simplest terms, GIS is the merging of cartography, statistical analysis, and database technology. Source: http://en.wikipedia.org/wiki/GIS
  Geolocation Geolocation is the identification of the real-world geographic location of an object, such as a cell phone or an Internet-connected computer terminal. Geolocation may refer to the practice of assessing the location, or to the actual assessed location. Source: http://en.wikipedia.org/wiki/Geolocation
  Geocoding Geocoding is the process of finding associated geographic coordinates (often expressed as latitude and longitude) from other geographic data, such as street addresses, or zip codes (postal codes). With geographic coordinates the features can be mapped and entered into Geographic Information Systems Source: http://en.wikipedia.org/wiki/Geocoding
Recap GIS  - System for mapping points and interacting with points. Geolocation  - Real world location of an object represented as coordinates. Could be the action of looking up or the stored values. Geocoding  - The action of looking up coordinates to map real world objects.
Creating a map  
The GMap Way Location Module + GMap
The OpenLayers Way OpenLayers + Geocode + Geofield
OpenLayers (map display) Manages information about the maps (not points) Displays Maps Integrates with views
Geofield (storage) Creates a new field type Flexible Output Ties in with Geocode module Can display a map for users to select a location
Geocode (lookup) Converts addresses into lat/long Uses the Geofield field type for storage Pulls information from other fields Can use different geocoding engines Good user experience Geocoding can be wonky outside of the U.S.
OpenLayers Proximity ***There is currently no D7 version*** Lets users search by distance Uses view as its interface
Locating your users  
Why? Hide/Change options depending on which country the user is in Redirect the user to a different version of the site Better user identification Better user experience
How? Find out the users IP Address Lookup the IP Address somehow and find out the location data. ??? Profit
Three Questions Will I be using this on mobile? How much money do I want to spend? Can I process the data at a later date? (and how much data)
Google Loader Pros: Free Returns more than just Lat & Long Unlimited Queries 2-4-1 Loading of JQuery Cons: Not always reliable Requires an external source Mobile & International results unreliable
HTML5 Geolocation Pros: Works great on mobile Uses GPS if possible Free Cons: Browser support is unreliable* Asks the user if you can use their location Only returns Lat & Long
Pay Databases & Services Pros: Can be internal or external Doesn't ask the user to use their location Cons: Can cost a lot of money Could have limited number of queries Might have the wrong location for mobile International data varies on levels below country
Which one to use? The right tool for the job + a backup method or Use the Smart IP module w/ Device Geolocation ($_SESSION['smart_ip']['location'])
Modules OpenLayers http://drupal.org/project/openlayers Geocode https://github.com/fillerwriter/geocode Geofield http://drupal.org/project/geofield Smart IP http://drupal.org/project/smart_ip Device Geolocation http://drupal.org/project/device_geolocation
Pay IP Services MaxMind http://www.maxmind.com IP2Location http://www.ip2location.com IPInfoDB http://ipinfodb.com/register.php
More Info OpenLayers (D6) Presentation by Patrick Hayes (Far more technical than my talk) http://yadadrop.com/drupal-video/gis-mapping-drupal-openlayers-geo OpenLayers (D7) Docs http://drupal.org/node/595872 OpenLayers (JS Library) http://openlayers.org/
Geolocation in Drupal (nodes & users) By Andrew M. Riley Mediacurrent Consultant @andrewmriley http://j.mp/rrpq2R

More Related Content

Geolocation in Drupal

  • 1. Geolocation in Drupal (nodes & users) By Andrew M. Riley Mediacurrent Consultant @andrewmriley
  • 2. Goal Introduce users to basic mapping concepts, OpenLayers configuration in Drupal and Geocoding users based off of IP address or device location. Disclaimer: Getting fancy may require some type of programming knowledge.
  • 4.   GIS A geographic information system, geographical information science, or geospatial information studies is a system designed to capture, store, manipulate, analyze, manage, and present all types of geographically referenced data. In the simplest terms, GIS is the merging of cartography, statistical analysis, and database technology. Source: http://en.wikipedia.org/wiki/GIS
  • 5.   Geolocation Geolocation is the identification of the real-world geographic location of an object, such as a cell phone or an Internet-connected computer terminal. Geolocation may refer to the practice of assessing the location, or to the actual assessed location. Source: http://en.wikipedia.org/wiki/Geolocation
  • 6.   Geocoding Geocoding is the process of finding associated geographic coordinates (often expressed as latitude and longitude) from other geographic data, such as street addresses, or zip codes (postal codes). With geographic coordinates the features can be mapped and entered into Geographic Information Systems Source: http://en.wikipedia.org/wiki/Geocoding
  • 7. Recap GIS  - System for mapping points and interacting with points. Geolocation  - Real world location of an object represented as coordinates. Could be the action of looking up or the stored values. Geocoding - The action of looking up coordinates to map real world objects.
  • 9. The GMap Way Location Module + GMap
  • 10. The OpenLayers Way OpenLayers + Geocode + Geofield
  • 11. OpenLayers (map display) Manages information about the maps (not points) Displays Maps Integrates with views
  • 12. Geofield (storage) Creates a new field type Flexible Output Ties in with Geocode module Can display a map for users to select a location
  • 13. Geocode (lookup) Converts addresses into lat/long Uses the Geofield field type for storage Pulls information from other fields Can use different geocoding engines Good user experience Geocoding can be wonky outside of the U.S.
  • 14. OpenLayers Proximity ***There is currently no D7 version*** Lets users search by distance Uses view as its interface
  • 16. Why? Hide/Change options depending on which country the user is in Redirect the user to a different version of the site Better user identification Better user experience
  • 17. How? Find out the users IP Address Lookup the IP Address somehow and find out the location data. ??? Profit
  • 18. Three Questions Will I be using this on mobile? How much money do I want to spend? Can I process the data at a later date? (and how much data)
  • 19. Google Loader Pros: Free Returns more than just Lat & Long Unlimited Queries 2-4-1 Loading of JQuery Cons: Not always reliable Requires an external source Mobile & International results unreliable
  • 20. HTML5 Geolocation Pros: Works great on mobile Uses GPS if possible Free Cons: Browser support is unreliable* Asks the user if you can use their location Only returns Lat & Long
  • 21. Pay Databases & Services Pros: Can be internal or external Doesn't ask the user to use their location Cons: Can cost a lot of money Could have limited number of queries Might have the wrong location for mobile International data varies on levels below country
  • 22. Which one to use? The right tool for the job + a backup method or Use the Smart IP module w/ Device Geolocation ($_SESSION['smart_ip']['location'])
  • 23. Modules OpenLayers http://drupal.org/project/openlayers Geocode https://github.com/fillerwriter/geocode Geofield http://drupal.org/project/geofield Smart IP http://drupal.org/project/smart_ip Device Geolocation http://drupal.org/project/device_geolocation
  • 24. Pay IP Services MaxMind http://www.maxmind.com IP2Location http://www.ip2location.com IPInfoDB http://ipinfodb.com/register.php
  • 25. More Info OpenLayers (D6) Presentation by Patrick Hayes (Far more technical than my talk) http://yadadrop.com/drupal-video/gis-mapping-drupal-openlayers-geo OpenLayers (D7) Docs http://drupal.org/node/595872 OpenLayers (JS Library) http://openlayers.org/
  • 26. Geolocation in Drupal (nodes & users) By Andrew M. Riley Mediacurrent Consultant @andrewmriley http://j.mp/rrpq2R