Dragging/moving multiple geojsons on leaflet-geoman

280 Views Asked by At

I'd like to move/drag geojson features on map so that the distance to each other stays the same.

Choose geojsons by clicking them and then dragging them together. How should I make this?

Thanks!

I read about syncLayersOnDrag but can not get it to work.

1

There are 1 best solutions below

1
On BEST ANSWER

If you set syncLayersOnDrag after adding the layer, it works

// data are coming from smaple-geojson.js
const geoLayer = L.geoJSON([bicycleRental, campus]).addTo(map)
map.fitBounds(geoLayer.getBounds())

map.pm.setGlobalOptions({
    syncLayersOnDrag: true
});

https://jsfiddle.net/zba1ogjL/