Add streams to 511mn layer
This commit is contained in:
parent
a6ff3d42f0
commit
f8e1126444
4 changed files with 58 additions and 4 deletions
17
main.js
17
main.js
|
|
@ -96,16 +96,25 @@ function objectToTable(o) {
|
|||
|
||||
// from https://openlayers.org/en/latest/examples/icon.html
|
||||
map.on('click', function (evt) {
|
||||
const feature = map.forEachFeatureAtPixel(evt.pixel, function (feature) {
|
||||
let layer;
|
||||
const feature = map.forEachFeatureAtPixel(evt.pixel, function (feature, l) {
|
||||
layer = l;
|
||||
return feature;
|
||||
});
|
||||
if (!feature) {
|
||||
return;
|
||||
}
|
||||
if (layer.hasOwnProperty('customPopup')) {
|
||||
content.innerHTML = layer.customPopup(feature);
|
||||
if (layer.hasOwnProperty('customPopupCallback')) {
|
||||
layer.customPopupCallback(feature);
|
||||
}
|
||||
} else {
|
||||
// exclude geometry -- https://stackoverflow.com/a/208106
|
||||
const {geometry: _, ...featureData} = feature.values_;
|
||||
|
||||
// exclude geometry -- https://stackoverflow.com/a/208106
|
||||
const {geometry: _, ...featureData} = feature.values_;
|
||||
content.innerHTML = objectToTable(featureData);
|
||||
}
|
||||
|
||||
content.innerHTML = objectToTable(featureData);
|
||||
popupOverlay.setPosition(evt.coordinate);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue