Re: [R] Info on SPATSTAT window and maps

From: Roger Bivand <Roger.Bivand_at_nhh.no>
Date: Wed 04 Apr 2007 - 11:34:01 GMT


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@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@nhh.no

______________________________________________
R-help@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.
Received on Wed Apr 04 21:38:06 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 04 Apr 2007 - 12:31:00 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.