[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-help
Subject:    Re: [R] Volume of polygon
From:       Sarah Goslee <sarah.goslee () gmail ! com>
Date:       2023-12-06 13:55:01
Message-ID: CAM_vjuk9zLR7V-wXr4wFxX7etjdrrW6G5TQz6dFGUdFGRikbbg () mail ! gmail ! com
[Download RAW message or body]

There's also an excellent discussion of various methods with R code
here: https://dewey.dunnington.ca/post/2019/bathymetry-lake-volume-estimation-using-r/


On Wed, Dec 6, 2023 at 8:52 AM Sarah Goslee <sarah.goslee@gmail.com> wrote:
>
> Hi,
>
> As already mentioned, this is a great topic for R-sig-geo, where you'd
> probably get specialist answers like the lake morphology package
> https://cran.r-project.org/web/packages/lakemorpho/index.html which is
> explicitly designed for this kind of question.
>
> Sarah
>
> On Tue, Dec 5, 2023 at 11:13 PM javad bayat <j.bayat194@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@yahoo.com
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help@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.
>
>
>
> --
> Sarah Goslee (she/her)
> http://www.sarahgoslee.com



-- 
Sarah Goslee (she/her)
http://www.sarahgoslee.com

______________________________________________
R-help@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.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic