Location and Mapping in Drupal: WHERE IT’S AT WHERE IT’S AT Martin Anderson-Clutz Digital Echidna
What This Presentation IS • A primer on mapping and location for websites • A comparative look at Drupal solutions • An outgrowth of my personal experience in in building a location and mapping site – YMMV • A work in progress – Feedback is welcome!
What it IS NOT • Detailed, step-by-step instructions • An exhaustive look at every option available – Chime in if you have a favourite that isn’t mentioned!
CONTEXT CONTEXT
Use Cases • Static Map – “Our Locations” • Dynamic Map – “Users Logged In” • Relative Locations – “Retailers < 10km”
Core Concepts • Mapping – Visualizing location data, often with known landmarks for reference • Geocoding – Enriching the description of a location with geographic coordinates • Description: “103 King St., London, ON” • Coordinates: 42.981860, -81.251414
Let’s look at some OPTIONS OPTIONS
Mapping Options • Google, OpenStreetMaps, Leaflet, Bing, Yahoo, MapQuest, etc. • Considerations: – Customizability – License restrictions • Limits • Use in paid and/or private sites • Offline use
Geocoding Options • Google, OpenStreetMaps, Bing, Yahoo, MapQuest, etc. • Considerations: – Limits – Speed – Uptime – Able to store results
API Limits
Drupal Options • Raw embed • Simple Google Maps • Location Map • Location • Geolocation Field • Get Locations • GeoField
Raw Embed • Put location into Google Maps (or other map site with embed function) • Copy and paste embed code into Drupal (body text, block, bean, etc.) • Ensure text format applied allows necessary tags
Raw Embed • PRO – Simple setup – No API key required • CON – Update requires redo on external site – Allowing editor update may require allowing broader access on rest of site – Doesn’t scale
Simple Google Maps • 100% reliant on Google • No geocoding, output is effectively a single-result Google Maps search • Update the input text to update the address
Simple Google Maps • PRO – Simple to implement – Simple to update – No API key required • CON – No option to manually tweak location or map – Potential for bad (even erroneous) input – Only show one location
Location Map • Similar to Simple Google Maps – relies on Google, map for one node • Allows for fine tuning of location
Location Map • PRO – Simple to implement – Simple to update – No API key required – Option to manually tweak location or map • CON – Only show one location
Location, GMap • Location provides an API, storage, and geocoding – Submodules provide additional data points and integrations • Gmap module provides maps – May be possible to use Get Locations Map instead
Location, GMap • PRO – Proximity search is baked in – Views integration • CON – Limited options for geocoding and mapping – Was late to game with D7, no releases yet for D8 – Fatal error in Location geocoding config. Raised two years ago, no resolution – Non-standard way of managing attachment to content types
Geolocation Field • Provides a field designed to be a simple method for storing coordinates and related data • Options for geocoding, proximity, HTML5 input and maps by Google • Stable D8 release already available, as a complete rewrite
Geolocation Field • PRO – Powerful – Simple setup – Use with all fieldable entities – Sweet HTML5/Google Places input – D8 ready-ish • CON – Current integrations tied to Google – Map input doesn’t allow for storage and display of address
Example Interface
Example Config
Get Locations • By default builds a map per node and per content type • Options to use different libraries to cluster, different markers, etc. • Google Maps API v3, Leaflet, others for mapping, geocoding via Google or OpenStreetMaps • Can be used in conjunction with Views, Geofield, Addressfield, Geolocation, Location, Getdirections, Smart IP, Openlayers, Colourbox, more • Get Locations Fields does a Google Places search on place name and will populate address • Current D8 stance is leaving the work of porting to others
Get Locations • PRO – Views support – Very active development – Loads of options for input, display – Populates address information • CON – No D8 releases yet – Works best with locations already in Google
Budweiser Gardens
Bud Gardens Interface
Budweiser Gardens
GetLocations Config
GetLocations Config
GetLocations Config
GetLocations Config
GeoField • Perhaps the most talked about D8 location solution • By itself is a container for coordinate data – Addressfield and Geocoder to interpret from natural language • Multiple mapping solutions – Openlayers is an amazing but complex toolkit • Proximity search including Solr
GeoField • PRO – Ability to customize virtually any part of the location handling and mapping – Seems to be the solution with the most momentum • CON – You’re about to find out how deep the rabbit hole goes – Some challenges in using different pieces to assemble a solution – No documentation yet for recommended version of OpenLayers (7.x-3.0-beta3)
Lehigh University
Lehigh University
Lehigh University
Lehigh University
Lehigh University • https://memories.lehigh.edu/locations/ 159
Example Interface
Example Interface
Addressfield Config
GeoField, OpenLayers
OpenLayers: Map Settings
OpenLayers: Map Settings
OpenLayers: Layers, Sources
OpenLayers: Controls
OpenLayers: Interactions
OpenLayers: Components
Drupal 8 • Geolocation – stable • GetLocations – asked for assistance • Geofield – alpha • Addressfield – replaced by Address (beta) • Geocoder – beta • Leaflet – beta • OpenLayers – to start after 7.x-3.x branch stable
PIECING THEM PIECING THEM TOGETHER TOGETHER
Location Tools Simple Google Map Simple Google Map Location Map Location Map Geolocation Geolocation Field Field Location Location Get Locations Get Locations GeoField GeoField D7 7.x-1.2 7.x-2.3 7.x-1.6 7.x-3.7 7.x-1.17 7.x-2.3 Released 2014-Jan-03 2014-May-24 2014-Nov-03 2015-Aug-04 2015-Oct-08 2014-Sep-21 D7 Users 26,954 13,355 12,394 47,755 9,099 39328 D8 8.x-1.x-dev 8.x-2.x-dev 8.x-1.4 n/a n/a 8.x-1.0-alpha1 Released 2015-Oct-11 2013-Sep-30 2014-Oct-12 2014-Oct-28 D8 Users 36 14 20 Dependencies GMap Module (for Modules map) Libraries Addressfield Libraries Services Google Google Google Views integration Y Y Y Y N Proximity Y Y Y Y N N Documentatio n N Y Y Y N N Submodules Location, User Locations, Getlocations Search, Compatible Modules: Phone and Location Fax, Getlocations Block, Addressfield, Location Search, Location Getlocations Location OpenLayers, Static Map, CCK, Location Generate, Taxonomize, Getlocations Leafle, Leaflet Widget, Location Add Another, Map, Getlocations Leaflet, Geocoder, Geocoder Location Entity, Search Getlocations Tools, AutoComplete, Address API Getlocations GPS Field, Sync PostGIS, Location Taxonomy, Openlayers Apachesolr, Location Email Openlayers CCK Migrate, RSS Field Formatters, Views GeoJSON, Search API Location, Spatial Tools, Geofield PostGIS, Geofield Proximity Plugin
Mapping Tools Simple Google Simple Google Location Map Location MapGeolocation Geolocation Field Field GMap GMap Get Locations Get Locations Leaflet Leaflet OpenLayers OpenLayers Map Map D7 7.x-1.2 7.x-2.3 7.x-1.6 7.x-2.10 7.x-1.17 7.x-1.3 7.x-3.0-beta3 Released 2014-Jan-03 2014-May-24 2014-Nov-03 2015-Sep-08 2015-Oct-09 2015-Jun-25 2015-Oct-08 D7 Users 26,006 13,477 12027 41,299 9,099 9.839 13,383 8.x-1.4 (2015- n/a D8 n/a 8.x-2.x-dev Oct-14) n/a 8.x-1.x-dev n/a Released 2013-Sep-30 D8 Users 4 Dependencies Geofield, Libraries, Modules Libraries cTools and Entity Libraries Leaflet Services Google Google Google Views integration Y Y Proximity Y Y Documentatio n N Y Submodules GMap Location, GMap Getlocations Search, OpenLayers UI, Taxonomy, Getlocations Block, OpenLayers Views, GMap Macro Builde Getlocations Location OpenLayers Geofield, Taxonomize, OpenLayers Examples, Getlocations Map, OpenLayers Bloc, Getlocations Leaflet, OpenLayers Getlocations Tools, Contextual Links, Getlocations GPS OpenLayers Services
Time to ROCK IT ROCK IT
Recommend
More recommend