Displaying maps within other content
Once you have configured a map in Cartaro you surely want to display it in appropriately. You could use the frontmap module if your site is very map-centric but integrating maps within other content is often preferable.
Setting up the map
Let's take a news article as example in which you want to have textual content accompanied by maps. Firstly, configure your map as shown in Getting Started with extensive detail. Note though, that the name of the map does not matter so calling it frontmap is not necessary.
Mind to enable all layers that you wish to display in the map configuration. You should check out the list of Behaviors offered there, too.
Enable maps in content
Drupal offers setting various transformation steps for content that allow to prepare a suitable presentation. We'll use this mechanism to integrate maps in the article this way.
Navigate to Configuration » Content authoring » Text formats and opt to configure the format called Plain text.
Comparison of mapping modules
This page aims to provide developers and site builders some navigation on the sea of options for the mapping of location data sets in Drupal D7. This is by no means an extensive survey. The idea is that by listing a number of the most popular modules side by side with their features, it will make it easier for the reader to shortlist modules for their specific needs before examining details on the various project and documentation pages.
In general you'll need at least two modules to create maps from location data: one to provide a location data storage facility and one to render the locations as markers on a map.
Examples of location storage modules are: Location, Geofield and Geolocation field and Get Locations.
Examples of map rendering modules are: IP Geolocation Views and Maps, GMap, Get Locations, OpenLayers and Leaflet. We've used these map renderers as the main index into the comparison table below (first row).
Read moreLeaflet
The Drupal 7 Leaflet module provides integration with Leaflet, the modern open-source JavaScript library for mobile-friendly interactive maps.
Leaflet currently offers:
- Field formatter that can show a map for fields that contain geospatial data
- Views integration that plots data on a map (using the sub module Leaflet Views)
- API for displaying data on a map
Leaflet extension modules
- Leaflet Markercluster - Provides Beautiful Animated Marker Clustering functionality for Leaflet using the Leaflet MarkerCluster library.
- Leaflet Widget for Geofield - a Geofield widget that uses the Leaflet widget plugin for adding and removing geometries.
- Leaflet More Maps - adds over 20 attractive map styles such as MapBox, Stamen, Thunderforest and Esri.
- Leaflet MapBox - use your own MapBox map tiles in your map views.
- Leaflet Google Maps - adds the possibility to choose Google Maps layers in leaflet maps.
Adding more Mapbox tilesets Tutorial
MapBox layer provides some baselayers, but you can add additional Mapbox layers (or Tilesets) into Openlayers yourself.
Thanks to DjebbZ for the original tutorial for D6.
Required modules
Instructions
Choose a Tile Set
- First, head to http://tiles.mapbox.com/mapbox in the official MapBox website.
- Choose the tileset you want to use. In this example we will assume that you want to use the World Blue tileset, but the following applies for every tileset. Note the layer name: it is the last part of the url. For the World Blue tileset, it is world-blue.
- In the right part of the page, note the information you'll need in OpenLayers : the Zoom info, specified as a range. For the World Blue tileset the zoom levels are 0-8. Some tilesets may hold a file extension but if none is specified, use png).
Create a Layer
Now go back to your Drupal installation.
- Go to
admin/structure/openlayers/layers/addfor Drupal 7 to add a new layer. - In the list select MapBox.
- Then fill the form with the requested information:
Presentations and Videos for OpenLayers in D7
Videos
- Intro to OpenLayers in Drupal 7 (7 min) and tutorial
- Insertar mapas con Drupal 7 (14 min, Spanish)
- Contextual filters openlayers example
- Addressfield Geofields OpenLayers
OpenLayers 2.x Documentation for D7
For additional documentation, tutorials, links to presentation and upgrade information check OpenLayers 2.x Documentation for D6.
Note - D6 documentation is fairly correct except for the OpenLayers WKT field which is not present in D7. (Geofield is recommended however it has a number of critical issues)