Drupalized Web Mapping – Tim Stallmann, Savas Labs – Mapping modules for Drupal



Drupalized Web Mapping – Tim Stallmann, Savas Labs – Mapping modules for Drupal

0 1


nacis-drupal-mapping-talk

Talk on Drupal Mapping from NACIS 2015

On Github timstallmann / nacis-drupal-mapping-talk

Drupalized Web Mapping

Tim Stallmann, Savas Labs

@t_stallmannwww.savaslabs.comtimstallmann.github.io/nacis-drupal-mapping-talk

What is Drupal?

Why Drupal for Web Mapping?

Core Drupal Concepts

Mapping modules for Drupal

Requirements: GeoPHP / GEOS

Store data: Geofield, PostGIS Get data: Address Field (+ Autocomplete), Geocoder, GDAL Serve data: Views GeoJSON Map data: Leaflet, OpenLayers

3 recommended approaches: Leaflet -or- OpenLayers -or- Views GeoJSON + custom code

Leaflet

Lightweight, but less customizationRecommended modules: Leaflet, Leaflet More Maps, Leaflet Views

Example: warmshowers.org

OpenLayers

Lots of control via GUI, but corresponding overheadSee also: cartaro.org (bundling OpenLayers, PostGIS, etc. in a docker container)

Example: contratados.org

Views GeoJSON + custom code

"Headless Drupal" approach -- expose data via geojson and then map it yourself

Example: Durham's Civil Rights History

Demo

Spinning up a live site using drush (www.drush.org)Prerequisites: MAMP/LAMP/WAMP stack, drush installed

$ drush dl drupal
Project drupal (7.39) downloaded to /Users/tim/htdocs/mapping_demo/drupal-7.39.                                                     [success]
...

$ mv drupal-7.39/ docroot
$ cd docroot/

$ drush si --db-url=mysql://user:passwd@localhost/db_name
You are about to create a /Users/tim/htdocs/mapping_demo/docroot/sites/default/settings.php file and DROP all tables in your 'drupal_mapping_demo' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a while. Consider using the --notify global option.                                        [ok]
Installation complete.  User name: admin  User password: PFsfYU2Mvz                                                                 [ok]

$ drush en views,geofield,leaflet,leaflet_views,leaflet_more_maps,geocoder,views_ui -y
views was not found.                                                                                                                [warning]
geofield was not found.                                                                                                             [warning]
leaflet was not found.                                                                                                              [warning]
leaflet_more_maps was not found.                                                                                                    [warning]
The following projects provide some or all of the extensions not found:                                                             [ok]
views
geofield
leaflet
leaflet_more_maps
Would you like to download them? (y/n): y
Project views (7.x-3.11) downloaded to /Users/tim/htdocs/mapping_demo/docroot/sites/all/modules/views.                              [success]
Project views contains 2 modules: views, views_ui.
Project geofield (7.x-2.3) downloaded to /Users/tim/htdocs/mapping_demo/docroot/sites/all/modules/geofield.                         [success]
Project geofield contains 2 modules: geofield_map, geofield.
Project leaflet (7.x-1.3) downloaded to /Users/tim/htdocs/mapping_demo/docroot/sites/all/modules/leaflet.                           [success]
Project leaflet contains 2 modules: leaflet_views, leaflet.
Project leaflet_more_maps (7.x-1.14) downloaded to /Users/tim/htdocs/mapping_demo/docroot/sites/all/modules/leaflet_more_maps.      [success]
Project leaflet_more_maps contains 2 modules: leaflet_demo, leaflet_more_maps.
The following projects have unmet dependencies:                                                                                     [ok]
views requires ctools
geofield requires ctools, geophp
leaflet requires libraries
leaflet_more_maps requires libraries
Would you like to download them? (y/n): y
Project ctools (7.x-1.9) downloaded to /Users/tim/htdocs/mapping_demo/docroot/sites/all/modules/ctools.                             [success]
Project ctools contains 10 modules: views_content, term_depth, stylizer, page_manager, ctools_plugin_example, ctools_custom_content, ctools_ajax_sample, ctools_access_ruleset, bulk_export, ctools.
Project geophp (7.x-1.7) downloaded to /Users/tim/htdocs/mapping_demo/docroot/sites/all/modules/geophp.                             [success]
Project libraries (7.x-2.2) downloaded to /Users/tim/htdocs/mapping_demo/docroot/sites/all/modules/libraries.                       [success]
The following extensions will be enabled: views, geofield, leaflet, leaflet_more_maps, ctools, geophp, libraries
Do you really want to continue? (y/n): y
ctools was enabled successfully.                                                                                                    [ok]
ctools defines the following permissions: use ctools import
geofield was enabled successfully.                                                                                                  [ok]
geophp was enabled successfully.                                                                                                    [ok]
leaflet was enabled successfully.                                                                                                   [ok]
leaflet_more_maps was enabled successfully.                                                                                         [ok]
libraries was enabled successfully.                                                                                                 [ok]
views was enabled successfully.                                                                                                     [ok]
views defines the following permissions: administer views, access all views
					
				

Also -- manually install leaflet library to sites/all/libraries/leaflet

Further resources:

  • tinyurl.com/drupal-mapping-guide
  • savaslabs.com/2015/07/06/map-in-drupal-8.html
  • mappingdrupal.com/
  • www.cartaro.org
  • github.com/savaslabs/durham-civil-rights-map

@t_stallmanntimstallmann.github.io/nacis-drupal-mapping-talk

Drupalized Web Mapping Tim Stallmann, Savas Labs@t_stallmannwww.savaslabs.comtimstallmann.github.io/nacis-drupal-mapping-talk