[R] Volume of polygon
javad bayat
j@b@y@t194 @end|ng |rom gm@||@com
Wed Dec 6 06:24:30 CET 2023
Dear Bert;
Thank you for your reply. The reservoir is not cylindrica. This is the
table I have created from the data extracted.
Maybe there is a way to get the relation between Elevation, Area and Volume
to get the elevation at a specific Volume.
Sincerely
value Area Height Vol
3 2183 89.52593 125 11190.74
5 2181 98.92991 127 12564.10
6 2180 154.64484 128 19794.54
7 2181 123.92825 127 15738.89
9 2183 82.42211 125 10302.76
10 2183 150.12180 125 18765.23
On Wed, Dec 6, 2023 at 8:39 AM Bert Gunter <bgunter.4567 using gmail.com> wrote:
> The volume of a polygon = 0. Polyhedra have volumes.
>
> This may be irrelevant, but if the lake is cylindrical == constant cross
> sectional area at all depths, then height doubles when the volume does and
> vice versa. Otherwise you have to know how area varies with height or use
> more sensible approximations thereto.
>
> Cheers,
> Bert
>
> On Tue, Dec 5, 2023, 20:13 javad bayat <j.bayat194 using gmail.com> wrote:
>
>> Dear all;
>> I am trying to calculate the volume of a polygon shapefile according to a
>> DEM raster. I have provided some codes at the end of this email.I dont
>> know
>> if the codes are correct or not. Following this, I have another question
>> too.
>> I want to know if the volume of the reservoir rises or doubles, what would
>> be the elevation?
>> I would be more than happy if anyone could help me.
>> Sincerely
>>
>> "
>> library(raster)
>> library(terra)
>> library(exactextractr)
>> library(dplyr)
>> library(sf)
>> r <- raster("Base.tif")
>> p <- shapefile("p.shp")
>> r <- crop(r, p)
>> r <- mask(r, p)
>> x <- exact_extract(r, p, coverage_area = TRUE)
>>
>> x1 = as.data.frame(x[1])
>> head(x1)
>> x1 = na.omit(x1)
>>
>> x1$Height = max(x1[,1]) - x1[,1]
>>
>> x1$Vol = x1[,2] * x1[,3]
>>
>> sum(x1$Vol)
>>
>> "
>>
>> --
>> Best Regards
>> Javad Bayat
>> M.Sc. Environment Engineering
>> Alternative Mail: bayat194 using yahoo.com
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
--
Best Regards
Javad Bayat
M.Sc. Environment Engineering
Alternative Mail: bayat194 using yahoo.com
[[alternative HTML version deleted]]
More information about the R-help
mailing list