3

I am looking for a Leaflet pluging for move (drag and drop), rotate or change a polygon or polyline feature. Also I´d like to capture the feature vertex coordinates once it has been moved to the new position. Otherwise is it posible to do that using perhaps OpenLayers o TurfJS? Which is the most appropiated way to do that, including saving modified feature into the backend?

2 Answers 2

4

A quick search found this answer, so your question is possibly a duplicate question:

Using Leaflet.Path.Transform to rotate polygons in Mapbox

which leads to this leaflet plugin:

Leaflet.Path.Transform which has this beautiful demo page.

That looks like the answer to your question, minus the getting the feature coordinates, which might be solved by exploring the answers to this question: Coordinates of Leaflet.Draw rectangle

As for saving to the back-end, I would search something like 'leaflet draw save to [backend]'

3
0

Maybe more of a long comment.. but:

The Leaflet.draw plugin covers most of the client-side functionality you're after - allowing users to draw/drag/edit etc.

But not rotate, which has been on an open request since 2013.

As noted by @Barrat you can use Leaflet.Path.Transform for rotation, however this won't play too nicely with Leaflet.draw (specifically, in terms of UX - they both provide their own interaction handlers which may conflict).

I've just started a plugin (Leaflet.draw.rotate) to merge the functionality of these two together, however it does not yet support rotating polygons/polylines (it is on the roadmap though).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.