[R] Using GIS data in R

Rolf Turner r.turner at auckland.ac.nz
Fri Apr 2 23:26:50 CEST 2010


On 2/04/2010, at 4:37 AM, Scott Duke-Sylvester wrote:

> I have a simple problem: I need to load a ERSI shapefile of US states
> and check whether or not a set of points are within the boundary of
> these states. I have the shapefile, I have the coordinates but I'm
> having a great deal of difficulty bringing the two together. The
> problem is the various GIS packages for R do not play well with each
> other. sp, shapefiles, maptools, etc all use different data
> structures. Can someone suggest a simple set of commands that will
> work together that will:
> 
> 1) load the shapefile data.
> 2) Allow me to test whether or not a (lng,lat) coordinate pair are
> inside or outside the polygons defined in the shapefile.


You may get some mileage out of looking at Adrian Baddeley's vignette
``Handling shapefiles in the spatstat package'' (available at the
entry for spatstat under contributed extension packages on CRAN).

For item 2) you may find the inside.owin() function in spatstat useful.

	cheers,

		Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list