Re: [R] importing shapefiles into spatstat

From: Roger Bivand <Roger.Bivand_at_nhh.no>
Date: Fri 30 Dec 2005 - 21:55:08 EST


On Fri, 30 Dec 2005, Mulholland, Tom wrote:

> You might also consider looking at the R-sig-Geo list which has lots of
> discussion about issues relating to file formats and the best ways to
> get data in and out the various packages that are used.

Yes, there are examples there. The current advice is to:

rSpatial <- "http://r-spatial.sourceforge.net/R" install.packages("spspatstat", repos=rSpatial) library(spspatstat)
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)

On occasion shapefiles are not well-behaved, so if you have lakes in islands in lakes, you may need to clean the shapefile first, but usually things go OK. If you need to follow this up, please move your reply to the R-sig-geo list - see the Spatial Task View on CRAN for easy access.

Roger

>
> Tom
>
> > -----Original Message-----
> > From: r-help-bounces@stat.math.ethz.ch
> > [mailto:r-help-bounces@stat.math.ethz.ch]On Behalf Of Charlotte Reemts
> > Sent: Friday, 30 December 2005 3:59 AM
> > To: r-help@stat.math.ethz.ch
> > Subject: [R] importing shapefiles into spatstat
> >
> >
> > Dear R users,
> > I am using spatstat to analyze point patterns (tree
> > locations). I would
> > like to import the shapefile with the study area polygons
> > (six total) into R
> > and use it to create the window for the spatstat analysis. I
> > do not simply
> > want to use a rectangle because the study areas spread out
> > over 40000 ha.
> > Any suggestions would be greatly appreciated.
> > Thanks,
> > Charlotte Reemts
> >
> >
> > Charlotte Reemts
> > Vegetation Ecologist
> > The Nature Conservancy--Fort Hood (TX) Project
> > P.O. Box 5190
> > Fort Hood, TX 76544-0190
> > 254-286-6745
> > fax: 254-288-5039
> > CReemts@tnc.org
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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
> >
>
> ______________________________________________
> 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
>

-- 
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
Received on Fri Dec 30 22:01:24 2005

This archive was generated by hypermail 2.1.8 : Sat 31 Dec 2005 - 00:04:17 EST