Upload
mediacurrent
View
6.436
Download
2
Embed Size (px)
DESCRIPTION
Maps and geolocation are becoming more and more important to the sites we build as the scope of our smallest projects become regional, national and global. Does your next project need to list store locations that sell a product world wide? Do you need to limit content for certain country descriptions? While these thoughts might be scary at first I promise it isn't voodoo and at the end of the talk you will know how to do all of these things.In this session I will walk you through Drupal common ways to:- Add maps to your site- Create locations on your maps (with and without views)- Locate your users in realtime- Search for locations within a distance- Use mobile devices for geolocation
Citation preview
Geolocation in Drupal(nodes & users)
By Andrew M. RileyMediacurrent 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 SystemsSource: 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?
1. Find out the users IP Address– Lookup the IP Address somehow and find out the location
data.– ???– Profit
Three Questions
1. 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'])
ModulesOpenLayershttp://drupal.org/project/openlayers
Geocodehttps://github.com/fillerwriter/geocode
Geofieldhttp://drupal.org/project/geofield
Smart IPhttp://drupal.org/project/smart_ip
Device Geolocationhttp://drupal.org/project/device_geolocation
Pay IP Services
MaxMindhttp://www.maxmind.com
IP2Locationhttp://www.ip2location.com
IPInfoDBhttp://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) Docshttp://drupal.org/node/595872
OpenLayers (JS Library)http://openlayers.org/
Geolocation in Drupal(nodes & users)
By Andrew M. RileyMediacurrent Consultant
@andrewmriley
http://j.mp/rrpq2R