Many thanks for your help!
Thanks to you guys I manage to solve my problem in an efficient way
All the best
J
On Tue, Oct 26, 2010 at 11:04 PM, Remko Duursma wrote:
>
> I don't know why I forgot that you can do this as well :
>
> area.poly(intersect(p1,p2))
>
> ... a bit more straightforward.
>
I don't know why I forgot that you can do this as well :
area.poly(intersect(p1,p2))
... a bit more straightforward.
greetings,
Remko
--
View this message in context:
http://r.789695.n4.nabble.com/calculate-area-between-intersecting-polygons-tp3012980p3014581.html
Sent from the R help mailin
Remko Duursma gmail.com> writes:
>
> Here is a different solution:
>
> library(gpclib)
> p1 <- as(poly1, "gpc.poly")
> p2 <- as(poly2, "gpc.poly")
>
> area.poly(p2) + area.poly(p1) - area.poly(union(p1,p2))
>
> I.e., take areas of both polygons and subtract the union (check
> plot(union(p1,p2)
Dear Jonas,
I already had to deal with such an issue.
Your can use the joinPolys function from the package PBSmapping, with "INT"
as operation.
The maptools package has functions SpatialPolygons2PolySet and
PolySet2SpatialPolygons to switch between formats suitable for sp or
PBSmapping.
Hope thi
Here is a different solution:
library(gpclib)
p1 <- as(poly1, "gpc.poly")
p2 <- as(poly2, "gpc.poly")
area.poly(p2) + area.poly(p1) - area.poly(union(p1,p2))
I.e., take areas of both polygons and subtract the union (check
plot(union(p1,p2)) ) to get the area of the intersection.
greetings,
R
jonas garcia googlemail.com> writes:
>
> Thanks for your reply,
>
> My main issue is that I don't have any equations to generate the data, just
> a bunch of points, each corresponding to a polygon.
>
> I was looking in package "sp" and there is a function to calculate areas (
> areapl()), but
Thanks for your reply,
My main issue is that I don't have any equations to generate the data, just
a bunch of points, each corresponding to a polygon.
I was looking in package "sp" and there is a function to calculate areas (
areapl()), but not for intersecting polygons. Is there any other packag
Dear Jonas,
if you can write the difference in y-values between your polygons as a
function, you can use
integrate() to get the area between the polygons.
It sounds like perhaps your x-values will not match between the polygons
because they come from different sources, so you probably have to do
Dear list:
I am trying to calculate the intersection area between two irregular
polygons (see example data below).
set.seed(1234)
theta <- seq(0, 2 * pi, length=(100))
poly1<- cbind(c(0 + 1 * cos(theta) + rnorm(100, sd=0.1)), c(0 + 2 *
sin(theta)))
poly2<- cbind(c(0 + 2 * cos(theta) ), c
9 matches
Mail list logo