Skip to content

Commit 773b737

Browse files
committed
region id on click
1 parent 1b3167d commit 773b737

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

index.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
map.on('load', function () {
3838
map.addSource('pmtiles-source', {
3939
type: 'vector',
40-
// url: 'pmtiles://http://127.0.0.1:8000/complete.pmtiles'
40+
// url: 'pmtiles://http://127.0.0.1:8000/86873.pmtiles' // use this when developing locally
4141
url: 'pmtiles://https://s3.cl4.du.cesnet.cz/4f4743b6_4043_4e02_a3ba_0452aa7523a2:uscuni-public/complete.pmtiles'
4242
});
4343

@@ -109,7 +109,7 @@
109109
// add regions hulls for debugging purposes
110110
map.addSource('geojson-source', {
111111
type: 'geojson',
112-
// data: 'http://127.0.0.1:8000/regions.geojson'
112+
// data: 'http://127.0.0.1:8000/regions.geojson' // use this when developing locally
113113
data: 'https://uscuni.org/himoc/regions.geojson'
114114
});
115115

@@ -124,6 +124,13 @@
124124
}
125125
});
126126

127+
map.on('click', 'geojson-layer', function (e) {
128+
new maplibregl.Popup()
129+
.setLngLat(e.lngLat)
130+
.setHTML(e.features[0].properties.labels)
131+
.addTo(map);
132+
});
133+
127134
// add layer control
128135
const layers = [
129136
{ id: 'pmtiles-layer', name: 'Buildings' },

0 commit comments

Comments
 (0)