2GIS Map API
Quckstart with 2GIS Map API
by Trufi
HTML
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2GIS Map API</title>
<meta name="description" content="Quckstart with 2GIS Map API">
</head>
<body>
<div id="container"></div>
<script src="https://mapgl.2gis.com/api/js"></script>
</body>
CSS
html,
body,
#container {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
JavaScript
// API key can be used on jsfiddle.net only!
// You can get more info on https://mapgl-docs.2gis.com
const map = new mapgl.Map('container', {
center: [55.31878, 25.23584],
zoom: 17.5,
key: 'bfd8bbca-8abf-11ea-b033-5fa57aae2de7',
pitch: 45,
});
const marker = new mapgl.Marker(map, {
coordinates: [55.31878, 25.23584],
interactive: false,
});
map.on('click', (ev) => alert('click to map'));