importing shapefiles into spatstat

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

importing shapefiles into spatstat

Charlotte Reemts
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
[hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: importing shapefiles into spatstat

Don MacQueen
Go to CRAN, to the "Packages" page, do a simple search on the text "shape".
It will quickly lead you to
   maptools tools for reading and handling shapefiles
 From there, I guess you'll have to extract the polygons from the
structure that is returned by the function(s) in the maptools package.
-Don



At 1:59 PM -0600 12/29/05, Charlotte Reemts wrote:

>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
>[hidden email]
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


--
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: importing shapefiles into spatstat

Don MacQueen
And I see that I am probably already be out of date! There is a nice
article in R News Volume 5/2, November 2005, available from CRAN.
-Don

At 1:41 PM -0800 12/29/05, Don MacQueen wrote:

>Go to CRAN, to the "Packages" page, do a simple search on the text "shape".
>It will quickly lead you to
>    maptools tools for reading and handling shapefiles
>  From there, I guess you'll have to extract the polygons from the
>structure that is returned by the function(s) in the maptools package.
>-Don
>
>
>
>At 1:59 PM -0600 12/29/05, Charlotte Reemts wrote:
>>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
>>[hidden email]
>>
>> [[alternative HTML version deleted]]
>>
>>______________________________________________
>>[hidden email] mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>
>--
>--------------------------------------
>Don MacQueen
>Environmental Protection Department
>Lawrence Livermore National Laboratory
>Livermore, CA, USA
>
>______________________________________________
>[hidden email] mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


--
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: importing shapefiles into spatstat

Mulholland, Tom
In reply to this post by Charlotte Reemts
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.

Tom

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]On Behalf Of Charlotte Reemts
> Sent: Friday, 30 December 2005 3:59 AM
> To: [hidden email]
> 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
> [hidden email]
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: importing shapefiles into spatstat

Roger Bivand
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: [hidden email]
> > [mailto:[hidden email]]On Behalf Of Charlotte Reemts
> > Sent: Friday, 30 December 2005 3:59 AM
> > To: [hidden email]
> > 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
> > [hidden email]
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
>
> ______________________________________________
> [hidden email] 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: [hidden email]

______________________________________________
[hidden email] 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
Department of Economics
NHH Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway