Skip to content

Installation ​

Geo Maps requires Craft CMS 5.10 or later and PHP 8.2 or later.

From the Plugin Store ​

In the control panel, go to Plugin Store, search for Geo Maps and click Install.

With Composer ​

bash
composer require suprim/geomaps
php craft plugin/install geomaps

Your first map in five minutes ​

  1. Create the field. Go to Settings → Fields → New field. Name it “Location” (handle location) and choose Geo Maps as the field type. The defaults are fine; set Limit Search to Countries if your places are in one country.
  2. Add it to an entry type. Open an entry type under Settings → Entry Types, drag the field into its layout and save.
  3. Set a location. Edit an entry, type an address in the field’s search and pick a suggestion. Save.
  4. Show it. In the entry’s template:
twig
{% if entry.location %}
  <p>{{ entry.location.full_address }}</p>
  {{ entry.location.embed({ width: 800, height: 400 }) }}
{% endif %}

Your layout needs Craft’s {{ head() }}, {{ beginBody() }} and {{ endBody() }} hooks for the map to load. Most layouts already have them.

  1. Search by distance. List entries near a place, nearest first:
twig
{% for place in craft.entries().location({ location: 'Sydney, Australia', radius: 20 }).all() %}
  {{ place.title }}: {{ place.location.distance|number_format(1) }} km
{% endfor %}

Next steps ​

  1. Optionally choose Mapbox or Google Maps as the map service under Settings → Plugins → Geo Maps (Configuration). Without a change, Geo Maps uses OpenStreetMap, with no key.
  2. Learn the field’s settings and drawing tools in The Field.
  3. Switching from another map plugin? See Importing Existing Fields.
  4. Browse the examples for complete templates, or Troubleshooting if something doesn’t work.