BraDyCMS

BraDypUS CMS

View the Project on GitHub jbogdani/BraDyCMS

Build and embed maps

BraDyCMS has a built-in (core) plugin that helps you to easily create and embed in articles bodies beautiful dynamic maps. You can use both Leaflet.js paired with OpenStreetMap (default option) or Google Maps to build your maps.


Simple map

Hands up: Since version 3.9 you do not have to create a custom map to include a simple map with only one marker in your articles.

You can use the custom tag map with a few attributes, e.g.:

[[map marker="44.51618,11.34238"]]BraDypUS[[/map]] or
[[map marker="44.51618,11.34238" zoom="7"]]BraDypUS[[/map]]

If you want to use Google Maps, instead of Leaflet, you should add the platform attribute:

[[map platform="google" marker="44.51618,11.34238"]]BraDypUS[[/map]] or
[[map platform="google" marker="44.51618,11.34238" zoom="7"]]BraDypUS[[/map]]

The marker attribute is required and should contain the x,y coordinates of the single marker you want to show on your map, separated by comma (,).

The zoom attribute is optional, but recommended and should contain the initial zoom of the map. If not provided an the best zoom level will be automatically calculated.

The content of the tag will be used as text for the marker popup. Please note that you can use rich HTML text here!


The plugin is located in:

Main menu > Plugins > User maps Or use [direct link](#usermap/view).

Create a new map

To create a new map click on the Add a new user map button and enter a map id. Please remember, form ids must be unique. No spaces, dashes, hyphens or other special characters are allowed in the map id. Once the new map has been created you can customize it to meet your needs. See the Custom map syntax for details.


Embed a map in article’s body

Embedding a map in an article’s body is very simple. Just use the custom tag [[map]] with the name/id of your map.

For example, to embed the map named whereweare in an article’s body just add this simple tag:

[[map]]whereweare[[/map]] You can aso provide fixed dimensions for your map using the `width` and `height` attributes, eg.:a subject directly in the form definition, overwriting  the custom one defined in the configuration file, e.g:

[[map iwdth="500px" height="300px"]]whereweare[[/map]] If these attributes are missing the default values of `width="100%"` and `height="400px"` will be used.

The Usermaps plugin requires the inclusion on the modules/usermap/usermap.js javascript file in the page template, in the head section of the document or before the closing of the body tag:

<script src="modules/usermap/usermap.js"></script>

Usermaps module requires jQuery. Please be sure to include the jQuery library before using the usermaps plugin.


Custom map syntax

The configuration of a user map must follow a simple but rigid syntax. The configuration file must be a valid json file. BraDyCMS integrates a real-time validator to help finding any syntax error.

General data


Markers definition


Example of a simple map, with only one marker

{
  "scrollWheelZoom": "false",
  "attribution": <a href=\"http:\/\/bradypus.net\" title=\"BraDypUS. Communicating Cultural Heritage\">BraDypUS</a>",
  "zoomToBounds": true,
  "markers": [
    {
      "coord": [44.51618, 11.34238],
      "name": "<strong>BraDypUS</strong>. Via A. Fioravanti, 72.<br /> 40129 Bologna Italy"
    }
  ]
}