[R-br] geracao de numeros aleatorios representativos de estacoes virtuais

walmes . walmeszeviani em gmail.com
Quinta Setembro 18 22:22:50 BRT 2014


Não existe, ou não precisa existir. Gerar malhas pode ser feito com funções
básicas. O mais específico da tarefa é verificar quais os pontos da malha
que estão dentro do polígono de interesse. Os pacotes de
estatística/visualização espacial geralmente trazem essas funções.

## plot(xlim=c(0,100), ylim=c(0,100), x=NULL, y=NULL)
## pol <- locator(n=10, type="l")
## dput(pol)

pol <-
structure(list(x = c(6.01340996391505, 32.5768681613431, 71.4454577296386,
96.6416791080815, 96.0557204713735, 81.6020740992435, 62.0701195423111,
57.773089539786, 22.8108908828769, 9.91980087530154), y =
c(13.011212611897,
9.73994454798204, 11.9207899239253, 44.6334705630748, 79.5269965781675,
95.2290832849592, 91.5216461458556, 36.5643426720846, 38.5271035104335,
24.5696931043964)), .Names = c("x", "y"))

plot(xlim=c(0,100), ylim=c(0,100), x=NULL, y=NULL)
polygon(pol, col="gray90")

xy <- expand.grid(x=seq(0,100,by=5), y=seq(0,100,by=5))

plot(xlim=c(0,100), ylim=c(0,100), x=NULL, y=NULL)
polygon(pol, col="gray90")
points(xy)

help(point.in.polygon, package="sp", help_type="html")
inside <- sp::point.in.polygon(xy$x, xy$y, pol$x, pol$y)

plot(xlim=c(0,100), ylim=c(0,100), x=NULL, y=NULL)
polygon(pol, col="gray90")
points(xy, col=inside)

xyin <- xy[as.logical(inside),]

plot(xlim=c(0,100), ylim=c(0,100), x=NULL, y=NULL)
polygon(pol, col="gray90")
points(xyin)

À disposição.
Walmes.

​
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20140918/cf29e44c/attachment.html>


Mais detalhes sobre a lista de discussão R-br