Loading

The Map View

A browse view with a location can offer a Map alongside its list, showing the current page of results as pins around the visitor's starting point. Each pin opens a small card you design.

Where to find it

Architect Panel → Layout & Pages:

  • Browse Views — the Browse View Builder's Location & Distance card and the Map Pin item appearance

Architect Panel → Integration & Connections:

  • Postcode Lookup — the positions the pins are placed at

Setting it up

  1. Set up the view's location: choose the Postcode Field and tick Offer Nearest First. The map does not appear without it. See Sorting by Distance.
  2. Tick Offer a Map View.
  3. In Map Provider, enter osm for OpenStreetMap, google for Google Maps, or leave it blank to use the installation default. Any other value is saved as blank.
  4. Under Item Appearances, write the Map Pin template: the card shown when a pin is clicked. It uses the same placeholder tags as the List template, and if left empty the List template is used.
  5. Click Save Browse Layout.

The two providers

  • OpenStreetMap needs no key and is the default when nothing is chosen. Tiles carry the credit "© OpenStreetMap contributors".
  • Google Maps needs a Google Maps key in the site configuration file, which the hosting administrator sets. It is the same key used for address autocomplete.

The installation default is the Map provider setting in Site Settings, Page Builder group; blank there means OpenStreetMap. Both providers are listed in the cookie consent register under preferences, so review your cookie notice when you add a map. See Cookie Consent.

What the visitor sees

  1. List and Map buttons above the results.
  2. The map needs a starting point. Until the visitor enters a postcode or uses their location, the map shows no pins, so tell them to do that first.
  3. Once a starting point is set, the map shows the current page of results, with "Showing page X of Y on the map." when there is more than one page. Moving to another page moves the pins.
  4. Records with no position cannot be pinned, and the map says how many: "1 result has no location and cannot be shown."

What goes wrong and how to tell

  • No Map button: Offer a Map View or Offer Nearest First is not ticked.
  • An empty world map: the visitor has not given a starting point yet.
  • "The map could not be loaded.": the map library or provider could not be reached, or Google was chosen with no key configured. Try osm.
  • A pin card shows a tag such as ##AMDATA_town##: that field is not ticked Show in Browse View in Field Configuration.
  • Fewer pins than results: the map shows one page at a time; raise Records Per Page (up to 100) if visitors need more at once.

Worked example

A volunteering directory ticks Offer a Map View, leaves Map Provider blank (OpenStreetMap) and writes a Map Pin template with the organisation's name, ##AMDATA_AMdistancetext## and a link built from ##AMDATA_ID##. A volunteer types their postcode, switches to Map, and sees the nearest 25 opportunities pinned around them, with a note that two have no location.

Recommendations

  • Keep the pin card short: a name, the distance and a link.
  • Prompt for a postcode in the view's introduction, because the map needs one.
  • Use OpenStreetMap unless you need Google's mapping.
  • Fill in missing locations; unplaced records never appear on the map.