-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
Discussed in geoman-io/leaflet-geoman#1562
Originally posted by sarahjiang888 February 14, 2025
The library I use is MapLibre-Geoman
I am building a map layer by layer with geoman.mapAdapter.addSource & geoman.mapAdapter.addLayer function.
But when I try to draw rectangle / polygon / ..., those drawn items will appear under above layer
Is there any way to make drawn items always appear on top of layer drawn with geoman.mapAdapter.addLayer?
the blue one is actually a drawn rectangle, but it appears under the layer drawn with geoman.mapAdapter.addLayer function, and causes it be partial-hidden.
`
const mapStyles: maplibregl.StyleSpecification = {
version: 8,
sources: {},
layers: [
{
id: 'background',
type: 'background',
paint: {
'background-color': 'white',
},
},
],
};
let geoman: Geoman;
try {
map.current = new maplibregl.Map({
container: mapContainer.current as HTMLElement,
style: mapStyles,
center: displayCenter,
zoom: zoomLevel,
attributionControl: false,
});
geoman = new Geoman(map.current, {
settings: {
controlsPosition: 'top-right',
throttlingDelay: 100,
},
});
catch (error) {
//...
}
if (map.current) {
map.current.on('gm:loaded', async function () {
try {
// add layer by layer with geoman.mapAdapter.addSource & geoman.mapAdapter.addLayer function
} catch (error) {
//...
}
});
}
`
Metadata
Metadata
Assignees
Labels
No labels
