I have a polygon and a Digital terrain model, I need to find a way to calculate the 3d volume of the area inside the polygon on leaflet. Is it possible to achieve it using some sort of formula or do I need an external library?

  • Are you actually rendering the DTM in Leaflet, ie, you have a grid of x,y, z values client side? If so, as it is a regular grid, it ought to be pretty straight forward to calculate the volume. I am reasonably certain that no Leaflet plugin/library will exist for what you are asking, but I could be wrong. – John Powell Jul 15 '19 at 15:31
  • Supposing i have a grid of x,y and z values what should be the formula to calculate the 3d volume based on the polygon ? – zakaria mouqcit Jul 15 '19 at 15:56
  • There is no such Leaflet plugin. Have a look at this library: codeproject.com/articles/13666/… – TomazicM Jul 15 '19 at 19:03
  • It is a DEM, so a regular grid, so no need for a polyhedral calculator. Calculate the area of intersection of each DEM square with the polygon using turfjs or similar, multiply each one by the height of DEM, sum. – John Powell Jul 17 '19 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.