Exposed ratio is less than 1 when fully exposed

Hello,

I am calculating the exposed ratio of some polygons using
→ select({, map(depth_sampled, geom → measure(geom) / measure(exposure)) as exposed_ratio})
→ select({
, min(sum(exposed_ratio), 1.0) as exposed_ratio})

but sometimes in the results when it should be 1 it is coming out as a number close to but less than 1

In the screen shot all buildings should have an exposed ratio of 1 but only the pink ones do.

Thanks

That looks like floating point inaccuracy - if it’s important to your model, you can add rounding like if(exposed_ratio > 0.99, 1.0, exposed_ratio)

The min function is there for similar reasons - it’s also possible for the ratio to exceed 1. Was that auto generated code from the wizard? If so, we could add an item to the backlog to insert that extra if check if it’s important.

Sweet thanks Nick, I am checking in the python function against 0.99 which is the only place it is used. I think the code did come from the wizard initially. I suppose it comes down to accuracy vs ease of use of the wizard.