TransWikia.com

Edit a shapefile with Leaflet.pm

Geographic Information Systems Asked on January 1, 2021

I am new to Leaflet but so far so good. I managed to add the plugins I needed and they work. Except the shapefile editing.

I am using leaflet.pm to draw, snap, cut polygons (only polygons). I also use
the Leaflet.shapefile to upload a shapefile in my map and convert it as a GeoJson. All of this works. My shapefile uploads perfectly and I can see my polygons. However, the editing does not. I tried to follow this post and comments associated without success.

I also followed this post but I am clearly stucked. I turned this in every directions I could tink off.

I saw in leaflet.pm page the part about editing but I am not sure how to use it / adapt it to my uploaded file.

This is my code: https://codepen.io/mscfourn/pen/YRZebJ

Can someone put me in the right direction using the edit mode of leaflet.pm?

PS: I checked the similar questions, they concern the plugin leaflet.draw, so I apologize in advance if you consider this as a duplicate.

One Answer

map.on('pm:edit', function (e) {

should be drawnItems.on('pm:edit', function (e) {

e is not very helpful without a lot of work. It does not contain the ID of the shape being edited nor does it contain the selected vertex. You would have to compare the e._layers to an earlier copy to get meaningful data.

Answered by nsharrok on January 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP