leaflet-2gis

Example with Leaflet and 2GIS tiles

by Trufi

HTML

<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css">
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<div id="map"></div>

CSS

html,
body,
#map {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

JavaScript

const map = L.map('map', {
  center: [25.23915, 55.30940],
  zoom: 13
});

L.tileLayer('https://tile{s}-cdn.maps.2gis.com/tiles?x={x}&y={y}&z={z}&v=1.0&ts=online_hd', {
  subdomains: '0123',
  attribution: '<a href="https://dev.2gis.com/" target="_blank" dir="ltr">API 2GIS</a>',
  maxZoom: 18,
}).addTo(map);