[R] Info on SPATSTAT window and maps
Roger Bivand
Roger.Bivand at nhh.no
Wed Apr 4 13:34:01 CEST 2007
On Wed, 4 Apr 2007, Giuseppe Brundu wrote:
> I wonder if there is any tutorial explaining, step by step, how to convert a
> (georeferenced) map boundary (from esri shape-file) into a Spatstat window,
> for performing the analysis of marked point patterns surveyed inside that
> map. Any help on the subject will be really appreciated.
Doing RSiteSearch("shapefile owin") shows that this is possible. The
current route is:
library(spatstat)
library(maptools)
your_sp <- readShapePoly("your.shp")
your_sp1 <- as(your_sp, "SpatialPolygons")
your_owin <- as(your_sp1, "owin")
plot(your_owin)
pp <- runifpoint(500, your_owin)
but you may need extra steps, for example to merge polygons or to remove
small polygon artefacts. Other functions in maptools would let you create
a ppp object from a SpatialPointsDataFrame, if you need that too.
You might also consider looking at the R-sig-Geo list for questions of
this kind.
>
> Giuseppe Brundu
>
> (University of Sassari, Italy)
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> 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.
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-help
mailing list