Mapping/GIS on Drupal * Geographic Information Systems 101 ---Manage geospatial information - store and analyze information about a specific physical location from a geographic point of view ---This can be reduced to: "Show stuff on a map" * Drupal GIS ---Combination of modules... currently Location and Gmap ---2008 roadmap involves the addition of two new modules, Geo and OpenLayers --- Associate location information with nodes --- Display nodes on a map * Current state of Drupal GIS ---Until early 2008, not good. ---Location2 - built for 4.x, extended (poorly) to 5.x. Several fundamental flaws ---Gmap - Google Map API has changed several times ---Interest - and community contributions - have steadily increased ---Location + Gmap + Views currently allows basic mapping applications. Complex applications require significant custom code and hackery. * Super-high-level overview ---Enter an address (5000 N. Lincoln) ---Geocoding happens (address -> Lat/Long) (37.0625,-80.677068) ---Display symbols on a map corresponding to addresses * Location module ---Stores and manages geospatial information associated with Drupal nodes ---Maintains human-readable location information (123 Main St.) for a variety of countries ---Manages geocoding process by connecting to an external provider ---Manages mapping (view) process by connecting to an external provider * Location supports many different countries ---Based on location.CC.inc where CC is country code ---country.inc files specify: 1. the provinces/states of that country 2. methods for getting a url to an external mapping provider, and links to TOS for external services 3. method for getting an imprecise lat/long based on postal data 4. methods for getting an exact geocode from a web service, and links to TOS for external services ---This info will be moved into a database in the future to allow for automatic updates, etc. * Location example -- United States ---List of states (Alabama, Alaska, Arizona...) ---External mapping providers (Google Maps FTW!) ---Postal-based geocoding (requires separate database of ZIP-to-Lat/Long lookups... 3.7MB SQL dump for US, 1.1MB for DE) ---External geocoding providers (Google, Yahoo, Geocoder.us, custom geocoder) * Problems with location module ---Was semi-abandoned until January 2008 (Bdragon to the rescue!) ---Postal-code geocoding involves a lot of cumbersome data (use 3rd parties instead) ---Ensures unnecessary MySQL3 compatibility by using kludgy hacks for basic GIS functionality (fixed by geo) ---Doesn't fully utilize the FormsAPI, making it difficult to theme (fixed in next version) ---Default theme for the location fieldset involves a table (fixed in next version) ---Doesn't respect versions, causing significant loss of data integrity (fixed in next version) * Location 2 to Location 3 improvements: ---easier to theme ---greater extensibility ---ability to associate locations with anything ---full revision support ---significant performance boost ---addition of Location CCK fields, allowing multiple locations to be tied to a node as well as all the coolness of CCK + views ---automatic garbage collection. ---local names for the different parts of a location (i.e. "State" in the US vs "Province" in Canada) * Location 3 data structure ---The location_instance table has nid, vid, uid, and lid columns; ---for any single entry in location_instance, either the nid, vid, and lid OR the uid and lid are required * Here comes geo! ---work on geo recently resumed after a hiatus - beta release estimated April 2008, production ready June 2008 ---geo.module is a geometry tool; it doesn't deal with things like addresses or zip codes, just spatial data. ---stores geospatial data. For optimization purposes, geo does this in database-specific ways, and takes advantage of PostGIS or Mysql Spatial when available. ---allow querying and complex spatial computations on the data, in a fast way. ---Geo becomes more useful with large datasets. ---Geo is compatible with both MySQL Spatial and PostGIS * Geometry? Spatial computations? GIS 201 ---traditional database architecture (structure, indexing, etc.) not suitable for geospatial work ---this needs to be addressed in various layers, including database, application, and presentation ---OpenGIS, Open Geospatial Consortium standards * Spatial Measurements: Finds the distance between points, polygon area, etc. * Spatial Functions: Modify existing features to create new ones, for example by providing a buffer around them, intersecting features, etc. * Spatial Predicates: Allows true/false queries such as 'is there a residence located within a mile of the area we are planning to build the landfill?' * Constructor Functions: Creates new features with an SQL query specifying the vertices (points of nodes) which can make up lines. If the first and last vertex of a line are identical the feature can also be of the type polygon (a closed line). * Observer Functions: Queries which return specific information about a feature such as the location of the center of a circle * Geo and Location: Peaceful Coexistence! ---Geo will take over all of Location's actual geospatial functionality ---Location will only provide address handling once Geo is released ---A migration path should be relatively trivial * Gmap module - embedded Google maps ---gmap.module is for displaying spatial data on maps. ---currently only works with points; geo will enable line and polygon information ---can get latitude/longitude data from location.module ---defines a display plugin for Views ---provides some default pages containing maps of nodes and users ---defines a macro language and provides an interface for building macros (looks like [gmap|stuff]) so that users can put maps in their content. ---allows basic map-based input * Gmap enhancements ---geo.module integration and compatibility ---additional views * OpenLayers - the future of mapping ---OpenLayers is a javascript library for displaying and interacting with map data ---Compatible with many data sources, including Google, Yahoo, World Wind, Virtual Earth, WMS/WFS, and many more ---Free/Libre - no restrictive Google TOS ---Drupal module projected beta release Summer 2008, production-ready Autumn 2008 * Questions?