[R-sig-Geo] [FORGED] Calculate each polygon percentage inside a circles
ASANTOS
alexandresantosbr at yahoo.com.br
Fri May 27 02:09:59 CEST 2016
Dear Rolf Turner,
Amazing!!!!! I will never put R in doubt.
My problem was solved with success, thanks very much again!!!
Best wishes,
Alexandre
--
======================================================================
Alexandre dos Santos
Proteção Florestal
IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
Campus Cáceres
Caixa Postal 244
Avenida dos Ramires, s/n
Bairro: Distrito Industrial
Cáceres - MT CEP: 78.200-000
Fone: (+55) 65 8132-8112 (TIM) (+55) 65 9686-6970 (VIVO)
alexandre.santos at cas.ifmt.edu.br
Lattes: http://lattes.cnpq.br/1360403201088680
OrcID: orcid.org/0000-0001-8232-6722
Researchgate: https://www.researchgate.net/profile/Alexandre_Santos10
LinkedIn: https://br.linkedin.com/in/alexandre-dos-santos-87961635
======================================================================
Em 25/05/2016 18:09, Rolf Turner escreveu:
> ==========================================================================
>
> library(spatstat)
>
> sr1 <- owin(poly=cbind(c(180114, 180553, 181127, 181477, 181294,
> 181007, 180409, 180162, 180114),
> c(332349, 332057, 332342, 333250, 333558,
> 333676, 332618, 332413, 332349)))
>
> sr2 <- owin(poly=cbind(rev(c(180042, 180545, 180553, 180314, 179955,
> 179142, 179437, 179524, 179979, 180042)),
> rev(c(332373, 332026, 331426, 330889, 330683,
> 331133, 331623, 332152, 332357, 332373))))
>
> sr3 <- owin(poly=cbind(rev(c(179110, 179907, 180433, 180712, 180752,
> 180329, 179875, 179668, 179572, 179269,
> 178879, 178600, 178544, 179046, 179110)),
> rev(c(331086, 330620, 330494, 330265, 330075,
> 330233, 330336, 330004, 329783, 329665,
> 329720, 329933, 330478, 331062, 331086))))
>
> sr4 <- owin(poly=cbind(c(180304, 180403,179632,179420,180304),
> c(332791, 333204, 333635, 333058, 332791)))
>
> wins <- solist(sr1,sr2,sr3,sr4)
>
> W <- union.owin(wins)
>
> set.seed(42)
> X <- rpoispp(28/area.owin(W),win=W)
> N <- npoints(X)
> plot(X,cols="blue")
> AD <- area.owin(disc(radius=600))
>
> pct <- matrix(nrow=N,ncol=4)
> rownames(pct) <- paste("point",1:N,sep=".")
> colnames(pct) <- paste("sr",1:4,sep=".")
> for(i in 1:npoints(X)) {
> Di <- disc(radius=600,centre=c(X$x[i],X$y[i]))
> for(j in 1:4) {
> Aij <- intersect.owin(Di,wins[[j]],fatal=FALSE)
> pct[i,j] <- if(is.null(Aij)) 0 else 100*area.owin(Aij)/AD
> }
> }
> ==========================================================================
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list