Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Drupal mapping modules


Published on

Published in: Technology
  • Login to see the comments

Drupal mapping modules

  1. 1. Mapping With Drupal
  2. 2. Geotagged Image KML Address GPXShapefiles KML Styles Maps Views GeoJSON Lat / Lon HTML5Draw on Map Layers Behaviors TileStache
  3. 3. Bounding BoxTopBottomLeftRight GeoPHP is used to Centroid calculate the Lat Bounding Box and Lon Centroid from the Geometry.GeometryStored in WKT Format Geometry Types:Soon will be WKB • PointWKT Example: • LineStringPOLYGON ((30 10, 10 20, • Polygon20 40, 40 40, 30 10)) • MultiPoint Query-able and indexable • MultiLineString • MultiPolygon Not Query-able. SELECTs only. • GeometryCollection
  4. 4. • User enters an address • KML (Google Earth) • Address is stored • GPX (Hand-held GPS) independently • Geo-tagged Image • Does not store lat / lon (smart-phone) Handlers call service Handlers parse • Google uploaded file into a • Yahoo geoPHP geometry • Yandex object • MapQuest Lat / LonDirect user input HTML5Is also supported Draw on Map More!
  5. 5. ESRI Shapefiles can imported intogeofields using OSGeo’s GDAL ogr2ogrlibraryRequires download and install of ogr2ogr
  6. 6. Latitude, Longitude 127 24’ 66’’ N, 23 23’ 56’’ W GeoJSON {"type":"Point","coordinates":[-123.3,30.78]} WKT POLYGON ((30 10, 10 20, 20 40, 40 40, 30 10))OpenLayers Map
  7. 7. OpenLayers and Views Repeat after me“I need to create two views. One view holdthe layer. The other view holds the map.”
  8. 8. GeoJSON View (views_geojson module) GeoJSON Layer1. Create a page view2. Add geofield field to field list /feeds/layer.json3. Set format to GeoJSON feed Layer should automatically and select geofield appear in your layers list Exposed & Contextual Filters OpenLayers Map View1. Create a page, block or pane OpenLayers Map view2. Set format to OpenLayers Map 1. Add layer to map and3. Optional: set-up exposed configure map as desired filters identically to first view 2. Click “Preview” to make sure4. Profit! your map is working
  9. 9. Maps Styles Brings Behaviors and Provide static and Layers (and implicitly dynamic styling to Styles and Layer-Types) olverlay layers. together in a JavaScript widget for displaying spatial data. Layers BehaviorsTwo classes: Behaviors are1. Base-Maps such as JavaScript snippets google maps or that make the map other “tiles” interactive in different2. Overlays that ways or provide map come from views UI functionality. or feeds
  10. 10. GeometryStored in WKB Format Query-able and indexable-- Find all pubs located within 250 meters of a hospital.SELECT, FROM bc_hospitals h, bc_pubs p WHERE ST_DWithin(h.geom, p.geom, 250);-- What is the largest municipality in British Columbia, by area?SELECT name, ST_Area(geom) as areaFROM bc_municipality order by area limit 1;-- What is the total length of all roads in BC, in kilometers?SELECT sum(ST_Length(geom))/1000 as km_roads from bc_roads;
  11. 11. PostGIS can be used as a spatial-query service in the same way that solr is used as asearch-query service. This example show us associating “Location” nodes with “Region”nodes using Geofield, node-references, and SyncPostGIS. Sync PostGIS Entity-save or cron GeoField (Polygon) Spatial Query on entity-save SELECT id from postgis where bundle = ‘region’ AND Entity Type ST_WITHIN($point, geom) Entity ID GeoField (Point) Entity Bundle Node-Reference Field Name Node ID of region Field Delta
  12. 12. PostGIS TileMillShapeFilesGeoTIFFKMLMore!