geoman-io / leaflet-geoman

🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers
https://geoman.io
MIT License
2.21k stars 433 forks source link

Display sq area/distance while drawing polygons/polylines/circles #351

Closed m0t0r closed 5 years ago

m0t0r commented 5 years ago

Hey @codeofsumit,

Thanks a lot for this project and your time!

I have been looking around the documentation and repo and was unable to find support for showing sq area/distance when drawing polygons/polylines/circles. I guess it's a feature request. I hope it can be added to this awesome library.

Thanks a lot!

codeofsumit commented 5 years ago

Will close until this has more upvotes. But definitely something I want to add within the next months! Thank you for the suggestion.

sbilbault commented 5 years ago

Hey @codeofsumit,

I would have the same feature request about distance/angle distance while drawing polygons/polylines.

Is there a way to pass a custom function to pm while drawing each segment of a polygon, which would enable to display these parameters ?

Thanks a lot,

codeofsumit commented 5 years ago

@sbilbault I think there are other plugins that offer that functionality. leaflet-measure-path for example.

kunKun-tx commented 4 years ago

turf.js works really well for calculating area.

turf.area(layer.toGeoJSON())
bw1984 commented 4 years ago

the method described by @kunKun-tx works perfectly for polygons with distinct vertices. does anyone know if a way to calculate the area of a drawn circle? my existing function throws no errors however the geometry object which the circle generates only contains one coordinate pair (the center point) so the area is always calculated as 0. Any suggestions?

kunKun-tx commented 4 years ago

@bw1984 it's probably easier to calc the circle area using its raduis layer.getRadius()?

ref: https://leafletjs.com/reference-1.6.0.html#circlemarker-getradius

codeofsumit commented 3 years ago

I all, this feature is now implemented in Leaflet-Geoman Pro which is the way we fund the development of this open-source library. Eventually, features of the Pro version will trickle down to the OSS library which is happening already with many features. If you use Leaflet-Geoman in a professional environment, please consider going for the Pro version to get more features and support this open source project.

measurement_hover measurement_options measurement_draw