2021-04-24 20:19:37 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
<title>Martin Debug Page</title>
|
|
|
|
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
|
2022-10-16 21:56:29 +03:00
|
|
|
<script src="https://unpkg.com/maplibre-gl@2.1.9/dist/maplibre-gl.js"></script>
|
|
|
|
<link href="https://unpkg.com/maplibre-gl@2.1.9/dist/maplibre-gl.css" rel="stylesheet" />
|
2021-04-24 20:19:37 +03:00
|
|
|
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#map {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div id="map"></div>
|
|
|
|
|
|
|
|
<script>
|
2022-10-16 21:56:29 +03:00
|
|
|
const map = new maplibregl.Map({
|
2021-04-24 20:19:37 +03:00
|
|
|
container: 'map',
|
2022-10-16 21:56:29 +03:00
|
|
|
style: 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json',
|
2021-04-24 20:19:37 +03:00
|
|
|
zoom: 0,
|
|
|
|
center: [0, 0]
|
|
|
|
});
|
|
|
|
|
|
|
|
map.on('load', function () {
|
|
|
|
map.addSource('points', {
|
|
|
|
type: 'vector',
|
2022-11-26 12:46:40 +03:00
|
|
|
url: `http://0.0.0.0:3000/points1,points2`
|
2021-04-24 20:19:37 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
map.addLayer({
|
|
|
|
id: 'red_points',
|
|
|
|
type: 'circle',
|
|
|
|
source: 'points',
|
2022-11-26 12:46:40 +03:00
|
|
|
'source-layer': 'points1',
|
2021-04-24 20:19:37 +03:00
|
|
|
paint: {
|
|
|
|
'circle-color': 'red'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
map.on('click', 'red_points', function (event) {
|
|
|
|
console.log(event.features);
|
|
|
|
});
|
|
|
|
|
|
|
|
map.addLayer({
|
|
|
|
id: 'blue_points',
|
|
|
|
type: 'circle',
|
|
|
|
source: 'points',
|
2022-11-26 12:46:40 +03:00
|
|
|
'source-layer': 'points2',
|
2021-04-24 20:19:37 +03:00
|
|
|
paint: {
|
|
|
|
'circle-color': 'blue'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
map.on('click', 'blue_points', function (event) {
|
|
|
|
console.log(event.features);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|