Skip to content

Getting Address From Map Markers

Justin Kimbrell edited this page Aug 28, 2014 · 2 revisions

Sometimes you need to be able to fetch the address for your markers for output within your template. To do so, you need to use the GoogleMaps_MapDataModel which is returned by your field type. Loop through the array of GoogleMaps_MarkerModel objects returned by the getMarkers() method.

{% for entry in craft.entries.section('news') %}

	{% for marker in entry.yourMapField.getMarkers() %}

		{{ marker.address }}<br>

	{% endfor %}

{% endfor %}