mirror of
https://github.com/maplibre/martin.git
synced 2024-12-20 05:11:57 +03:00
3c01125fc5
* feat: add composite sources support WIP * feat: handle empty composite sources * fix: decompose queries * docs: add docs on composite sources * ci: push docker image * test: add composite source tests
82 lines
1.9 KiB
HTML
82 lines
1.9 KiB
HTML
<!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" />
|
|
<script src="https://api.tiles.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.js"></script>
|
|
<link href="https://api.tiles.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.css" rel="stylesheet" />
|
|
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
#map {
|
|
position: absolute;
|
|
top: 0;
|
|
bottom: 0;
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="map"></div>
|
|
|
|
<script>
|
|
let accessToken = localStorage.getItem('accessToken');
|
|
|
|
if (!accessToken) {
|
|
accessToken = window.prompt('Mapbox accessToken');
|
|
localStorage.setItem('accessToken', accessToken);
|
|
}
|
|
|
|
mapboxgl.accessToken = accessToken;
|
|
|
|
const map = new mapboxgl.Map({
|
|
container: 'map',
|
|
style: 'mapbox://styles/mapbox/light-v9',
|
|
zoom: 0,
|
|
center: [0, 0]
|
|
});
|
|
|
|
map.on('load', function () {
|
|
map.addSource('points', {
|
|
type: 'vector',
|
|
url: `http://0.0.0.0:3000/public.points1,public.points2.json`
|
|
});
|
|
|
|
map.addLayer({
|
|
id: 'red_points',
|
|
type: 'circle',
|
|
source: 'points',
|
|
'source-layer': 'public.points1',
|
|
paint: {
|
|
'circle-color': 'red'
|
|
}
|
|
});
|
|
|
|
map.on('click', 'red_points', function (event) {
|
|
console.log(event.features);
|
|
});
|
|
|
|
map.addLayer({
|
|
id: 'blue_points',
|
|
type: 'circle',
|
|
source: 'points',
|
|
'source-layer': 'public.points2',
|
|
paint: {
|
|
'circle-color': 'blue'
|
|
}
|
|
});
|
|
|
|
map.on('click', 'blue_points', function (event) {
|
|
console.log(event.features);
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|