FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

measure: split volume into cut/fill/net, add DSM/DTM model selection by thadwald · Pull Request #1993 · WebODM/WebODM · GitHub

/ WebODM Public

measure: split volume into cut/fill/net, add DSM/DTM model selection - #1993

Draft
thadwald wants to merge 2 commits into
WebODM:masterfrom
thadwald:measure-cut-fill-dsm-dtm
Draft

thadwald wants to merge 2 commits into
WebODM:masterfrom
thadwald:measure-cut-fill-dsm-dtm

Conversation

Copy link
Copy Markdown
Contributor

The measure plugin previously calculated volume as the absolute value of the sum of cut and fill. It also incorrectly used the Digital Surface Model data for this calculation, even when the user had selected DTM as the visible layer.

Now the Measure results show

  • which model is being measured (DSM or DTM)
  • Cut (material below the plane)
  • Fill (material above the plane)
  • Net (fill - cut (signed) )

summary of changes to files:

MeasurePopup now determines which model to use and sends it with the volume call. it also displays all of the new information listed above.

dem_type parameter ("dim"/"dtm") was added to TaskVolume, which verifies that the resource exists and sends it with the calc_volume call.

calc_volume now calculates and returns cut, fill and net individually

thadwald and others added 2 commits July 27, 2026 01:48
Previously the measure plugin's volume tool collapsed cut and fill into
a single absolute number (abs of the signed sum), discarding the sign
information needed to distinguish material above vs. below the
interpolated base surface. It also always sampled dsm.tif regardless
of which raster layer (DSM/DTM) was active on the map when the
measurement was drawn.

- calc_volume() now returns {cut, fill, net} instead of one scalar.
  fill = material above the base surface, cut = material below it,
  net = fill - cut (signed).
- TaskVolume now accepts a dem_type ("dsm"/"dtm") parameter and reads
  the corresponding asset, validating the matching extent exists.
- MeasurePopup now reads the clicked layer's meta.type to determine
  which model to request, sends it along with the volume request, and
  displays which model (Surface/Terrain) plus Cut/Fill/Net in the
  flyout and GeoJSON export properties.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Error messages under 200 chars (e.g. a raw file-not-found path from
calc_volume) had no word-wrap rule and no whitespace to break on,
so they spilled outside the popup instead of wrapping. The .long
class only added scroll/max-height past the 200-char threshold,
which doesn't address horizontal overflow of an unbroken token like
a filesystem path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

pierotofy commented Jul 27, 2026
edited
Loading

Copy link
Copy Markdown
Member

Can you show one or two screenshots showing your UI changes and explain how did you test to verify this implementation is correct?

Copy link
Copy Markdown
Contributor Author

The test project involves a small pea rock fall protection pit surrounding a play structure at a school. The pit is bounded on three sides with a cement curb with the 4th side unfinished for dump truck access. I flew and modeled the site to determine the amount of pea gravel needed.

The original WebODM report indicated I need about 75 cubic yards, which comes neatly to 100 tons at 1.3 tons per cu.yd, or four truck loads. I noticed after a few loads that this would be short and added one more load, which filled the area.

So ODM estimation was short by about 20%.

The original number was 75 cu.yds.. I did not like that it was positive. I also saw that WebODM Lightning has a cut/fill illustration, so I tasked AI to add cut, fill, and signed Net volume.

The resulting numbers indicated why the estimate was off by 20%; it was using the surface model, which included the volume of the structure in the calculation and subtracted it from the estimate.

So I tasked AI to pass along the active layer as the target DEM. The resulting Fill is now correctly near zero and the resulting volume measurement closely matches the actual required volume for this job.

I tested it on a model without a DEM; it displays the "model not found" error in the flyout box, albeit with the long text flowing out of the box ... but this would be a change for a different PR. I also tested it on some stockpiles and quickly saw why this feature has little use in stockpile measurement. ( 1.) default DTM settings results in the the tops of stockpiles being chopped off, 2) Cut is always near zero, and 3) Stockpiles are always a positive volume). But it does no harm in this use case AND it is quite useful for non-stockpile applications, as I demonstrated here.

One design question that I had was; should the operation calculate the volume for all models available? I'm leaning towards "No" but it would be great to have more experienced minds weigh in.

Copy link
Copy Markdown
Member

Thanks for the screenshots and explanation of your dataset. But how did you verify that the output numbers are correct? (Do you understand the changes AI has written? How do you know they are correct?)

As an implementation note, you don't want the program to pick a default surface, you want to know if there are multiple surfaces available (none, DSM, DTM, DSM+DTM ?) under the area of the polygon (but remember, there could be multiple tasks in Project View!), if you have more than one surface then display a selector (defaulting to DSM).

Please do not simply copy paste this into an AI though; it does not help to just prompt additions to WebODM (I can do that too and it takes me 2 seconds). The real work is in validating these changes and testing (and if you can do that, then it helps, but if you can't, let's leave this as a "proof of concept"). 🙏

thadwald marked this pull request as draft July 28, 2026 03:51

Copy link
Copy Markdown
Contributor Author

So I do have at least some programming experience and, yes, I understand the changes that AI has written.
What I lack is an intuition for how WebOMD works. For instance, I didn't think of the fact that a project can have multiple tasks, so I didn't test or even consider what happens in that case. This issue of not being familiar with the project is probably going to persist.

You have given me some direction and I will keep working on it as I find time and in the meantime I have changed this pr to a draft.

thadwald force-pushed the measure-cut-fill-dsm-dtm branch from d30ba19 to 0c06bf2 Compare July 29, 2026 04:04

This branch has not been deployed

No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL