←Examples

Multiple Maps

Multiple maps on same page can be achieved by supplying unique mapID.

<script>
  import Map from "@anoram/leaflet-svelte";
   let options = {
    markers: [
      {
        lat: 13,
        lng: 80,
      },
    ],
    mapID: "map",
  };
  let options2 = {
    markers: [
      {
        lat: 1,
        lng: 1,
      },
    ],
    mapID: "map2",
  };
  
</script>

<style>
  .map {
    height: 600px;
    width: auto;
  }

</style>


<div class="map">
  <Map {options} />
</div>
<div class="map">
  <Map options={options2} />
</div>

Note

recenter by default is false, setting it to true and maxZoom/minZoom values will not work, however if you give value for zoom it will reset and recenter.