Maplace.js

Search and filters

Search this area

A switch above the list: every place, or only those in view as the map moves.

Markdown

Map and code

Run the examples on

Loading the map…

The map couldn't load.

Loading the map…

The map couldn't load.

Loading the map…

The map couldn't load.

Loading the map…

The map couldn't load.

Loading the map…

The map couldn't load.

Loading the map…

The map couldn't load.

Loading the map…

The map couldn't load.

Loading the map…

The map couldn't load.

These maps come from Google Maps and OpenFreeMap, which see your IP address. They stay off until you say so, once for the whole site. What loading the maps sends

<!doctype html>
<script src="https://cdn.jsdelivr.net/npm/@maplacejs/maplace@1/dist/maplace-element-maplibre.iife.js"></script>
<!-- A list on the map that follows it: its switch lists "All", or in "This area" what is in view as the map moves. -->
<maplace-map id="this-area-maplibre-map" list list-position="top-left" list-scope="viewport">
  <maplace-location location-id="lisbon" lat="38.7223" lng="-9.1393" title="Lisbon"></maplace-location>
  <maplace-location location-id="madrid" lat="40.4168" lng="-3.7038" title="Madrid"></maplace-location>
  <maplace-location location-id="paris" lat="48.8566" lng="2.3522" title="Paris"></maplace-location>
  <maplace-location location-id="brussels" lat="50.8503" lng="4.3517" title="Brussels"></maplace-location>
  <maplace-location location-id="amsterdam" lat="52.3676" lng="4.9041" title="Amsterdam"></maplace-location>
  <maplace-location location-id="berlin" lat="52.52" lng="13.405" title="Berlin"></maplace-location>
  <maplace-location location-id="copenhagen" lat="55.6761" lng="12.5683" title="Copenhagen"></maplace-location>
  <maplace-location location-id="vienna" lat="48.2082" lng="16.3738" title="Vienna"></maplace-location>
  <maplace-location location-id="prague" lat="50.0755" lng="14.4378" title="Prague"></maplace-location>
  <maplace-location location-id="warsaw" lat="52.2297" lng="21.0122" title="Warsaw"></maplace-location>
  <maplace-location location-id="rome" lat="41.9028" lng="12.4964" title="Rome"></maplace-location>
  <maplace-location location-id="athens" lat="37.9838" lng="23.7275" title="Athens"></maplace-location>
</maplace-map>

How it works

The list on the map, top left, has a switch above it: every place, or only those in view as the map moves.

  • HTML: list-scope="viewport" on <maplace-map>, beside list and list-position, with area-only-label, show-all-label and empty-area-label for its wording (Map attributes).
  • Script and Bundler: list: { scope: "viewport", position: "top-left" } in the map’s options, with areaOnlyLabel, showAllLabel and emptyAreaLabel (List view options; position, on Google, on MapLibre).
  • React: <LocationList scope="viewport" position="top-left" /> inside the <MaplaceMap> (<LocationList>).
  • Its corner: any of the four, top-left here. Left of the map is where a list has the most room on Google, which stacks its fullscreen button, camera control and Pegman on the right (On-map controls). Without a position, the list goes top right.