-
Notifications
You must be signed in to change notification settings - Fork 19
Adding Markers
Justin Kimbrell edited this page Aug 16, 2014
·
1 revision
Markers can be added to the map without the use of a field type. So if you have coordinates stored outside the field type, it's real easy to add them to a map. Obviously creating a page with a single marker is incredibly easy. In this example, a map is instantiated and two markers are added to the map. The map auto-centers around the markers that have been added.
{% set options = {
id: 'map',
width: '400px',
height: '300px'
} %}
{{ craft.googleMaps.map(options) }}
{% set marker = {
address: 'Rocky Mountain National Park',
content: 'Rocky Mountain National Park'
} %}
{{ craft.googleMaps.marker('map', marker) }}
{% set marker = {
address: 'Yellow Stone National Park',
content: 'Yellow Stone National Park'
} %}
{{ craft.googleMaps.marker('map', marker) }}