Reinos.nl internet media examples

Entries on a map

Maps 5.0.1 Live

All entries of a channel as one layer of markers, with a popup per entry and clustering. See Entries on a map.

Template
{exp:reinos_maps:html_header}
{exp:reinos_maps:map width="100%" height="400px" marker_cluster:enabled="yes" fit_map:markers="yes"}
	{maps:add_entries popup:max_width="250"}
		{exp:channel:entries channel="stores" dynamic="no" limit="2000"}
			{maps:entry latlng="{store_location:markers_latlngs}" title="{title:attr_safe}" keys="store_{entry_id}"}
				<h3>{title}</h3>
				<p>{entry_date format="%d-%m-%Y"}</p>
				<a href="{url_title_path='stores/detail'}">Details</a>
			{/maps:entry}
		{/exp:channel:entries}
	{/maps:add_entries}
{/exp:reinos_maps:map}
{exp:reinos_maps:html_footer}

<script>
	document.addEventListener('maps:entries:loaded', function (event) {
		console.log(event.detail.count + ' stores on the map');
	});
</script>

Build it in your own site

What this example needs in ExpressionEngine, step by step.

  1. Install Maps.
  2. Create the field, with these short names:
    Short nameTypeNotes
    store_locationMapsSet the field setting Mode to Single location: one marker per store, placed with the search field. Maps Locator indexes that marker, so this one field is the location for the map and the search.
  3. Create the channel stores (Stores) and assign the field.
  4. Put the code in a template.
  5. Add a few stores (the demo site has 34 bike stores in the Netherlands).

This example comes from the Maps docs: the preview runs exactly the code above.