Closed boeckMt closed 1 year ago
@voinSR, @MichaelLangbein and @lucas-angermann what do you think about this? I also think we can remove some properties from the ukis layer which are currently added.
extent: layer.bbox
filtertype: "layers"
id: "customLayerOlGroup_olUID:Layer_76"
map: `olMap`
maxResolution: Infinity
maxZoom: Infinity
minResolution: 0
minZoom: -Infinity
name: `ukis layer name`
opacity: 1
popup: `ukis popup`
preload: 0
source: `olLayerSource`
useInterimTilesOnError: true
visible: true
zIndex: 18
We could also remove most of them an if the user needs it get them with olMapSvc.getLayerByKey?
Possible properties to pass to prepareAddPopup()
interface IPopupProperties {
layerId: string;
layerName: string;
mapEvent?: any;
layer?: any;
feature?: any;
color?: Uint8ClampedArray | Uint8Array | Float32Array | DataView;
/** properties of the feature/layer or asyncData */
properties: any;
}
let properties: IPopupProperties = {};
...
// add layer and feature or color
We need a flat object so filter and rename work!
Some properties of the layer can be overwritten if they have the same name in the feature!
Also It would be a breaking change!!! if we remove the complete layer and event from raster
Properties of queryRenderedFeatures
// layers: https://maplibre.org/maplibre-style-spec/layers/#layers
// Sources: https://maplibre.org/maplibre-style-spec/sources/#sources
{
"geometry": {
"type": "MultiPolygon",
"coordinates":...
},
"type": "Feature",
"properties": any,
"layer": layers
"source": "openmaptiles",
"sourceLayer": "water",
"state": {}
}
Properties of layer.on(e: MouseEvent)
// layer
// feature
// properties
L.geoJson(data, {
style: style,
onEachFeature: (feature, layer)=>{
layer.on({
click: (e)=>{
layer = e.target;
feature = layer.feature;
properties = layer.feature.properties;
}
});
}
}).addTo(map);
map.eachLayer(layer => {
layer.bindPopup(...);
})
/**
evt: {
originalEvent: PointerEvent
containerPoint: Object
layerPoint: Object (x,y,...)
latlng: Object
type: "click"
target: NewClass (Map)
sourceTarget: NewClass
}
*/
map.on("click", (evt) => {
evt.target.eachLayer((l) => {
if (l.feature) {
console.log(l.feature);
} else if(l.getContainer) {
console.log(l.getContainer());
}
});
});
Description
Currently (ukis: v10.1.0), layer popups are given different properties whether they are for
raster
orvector
or they haveLayer.dynamicPopup
.The user should get a harmonized object with properties for
layer
,feature
and other stuff to visualize.Relevant Package
This feature request is for
@dlr-eoc/map-ol
Examples
raster: gets all
properties from the ukis layer
plusevent
andcolor
vector: gets all properties from the feature
dynamicPopup: gets all
properties from the ukis layer
plusevent
,feature
,layer
anddynamicPopup
itself