Yes there is more than one. I can't remember when I made the decision but I recall doing some speed tests and I picked inside.owin in the spatstat package. I think splancs and spatial might have their own versions as well. The overlay function in sp works. I think I found this too slow for what I was doing at the time. I haven't revisited this recently so it may be worth your while checking out the variations.
Tom > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Pierce, Ken > Sent: Wednesday, 13 December 2006 1:56 PM > To: r-sig-geo@stat.math.ethz.ch > Subject: [R-sig-Geo] Can you query points with a polygon? > > > If I have a set of points from a shapefile (or generated in R) and a > polygon from a shapefile, can I use the polygon to select the points > that fall within it? One of the many packages must do it but I can't > seem to figure which one. > > Thanks, > > Kenneth B. Pierce Jr. > Research Ecologist > Landscape Ecology, Modeling, Mapping and Analysis Team > PNW Research Station - USDA-FS > 3200 SW Jefferson Way, Corvallis, OR 97331 > [EMAIL PROTECTED] > 541 750-7393 > http://www.fsl.orst.edu/lemma/gnnfire > > > > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: Monday, December 11, 2006 3:00 AM > To: r-sig-geo@stat.math.ethz.ch > Subject: R-sig-Geo Digest, Vol 40, Issue 9 > > Send R-sig-Geo mailing list submissions to > r-sig-geo@stat.math.ethz.ch > > To subscribe or unsubscribe via the World Wide Web, visit > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > or, via email, send a message with subject or body 'help' to > [EMAIL PROTECTED] > > You can reach the person managing the list at > [EMAIL PROTECTED] > > When replying, please edit your Subject line so it is more > specific than > "Re: Contents of R-sig-Geo digest..." > > > Today's Topics: > > 1. Re: project the lat./long. to x/y (zhijie zhang) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 11 Dec 2006 09:05:44 +0800 > From: "zhijie zhang" <[EMAIL PROTECTED]> > Subject: Re: [R-sig-Geo] project the lat./long. to x/y > To: [EMAIL PROTECTED] > Cc: r-sig-geo@stat.math.ethz.ch > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain > > *Dear Roger Bivand* , > Your suggestions are very good, which gives me a general > method to do > projections. > Thanks. > > > On 12/6/06, Roger Bivand <[EMAIL PROTECTED]> wrote: > > > > On Wed, 6 Dec 2006, zhijie zhang wrote: > > > > > Dear friends, > > > I had a point pattern dataset, whose locations was defined > > by lat./long.. > > > In the past, I used ARCGIS to specify its coordinate > system and the > > > projection method, now i want to do it in R. I don't know > how to do > > > it, because it needs me to specify the *Geographic > Coordinate System > > > > and the Projected Coordinate System.* Maybe i mistake the > > > information in ARCGIS > > and > > > only the projection method need to be specified because of my poor > > knwledge > > > on coordiante systems. > > > > Coordinate systems are unusually difficult to understand for > everybody! > > > > In rgdal: > > > > EPSG <- make_EPSG() > > EPSG[grep("Xian", EPSG$note), 1:2] > > > > gives a list of the known projections including "Xian", > > > > among which: > > > > CRS("+init=epsg:2384") > > > > looks promising. The a= and b= specify the ellipsoid used, > but I have > > not been able to find an authority to confirm that it is > D_Xian_1980. > > One way to check would be to take a long/lat value in WGS84 > (for known > > > datum) and convert it to the target projection in both > ArcGIS and with > > > spTransform() in rgdal, and see how far they differ. I do not see > > anything helpful in http://www.asprs.org/resources/GRIDS - > referenced > > on the make_EPSG help page, which is often a good authority, so you > > may need to double-check with local sources. > > > > The way to go would be to make your (point?) data set into > a Spatial* > > object with a projection argument like CRS("+proj=longlat > > +ellps=WGS84") if the ellipsoid is correct, and use > spTransform to get > > > to the Gauss_Kruger Xian datum representation. > > > > Roger > > > > PS. Yes, the Windows binary of the rgdal version you give below was > > built on R 2.4.0 (you are on Windows?). You need to > download a Windows > > > binary package manually from > > http://cran.r-project.org/bin/windows/contrib/ > > (there is a 0.4-12 version for R 2.3); the same may apply to other > > packages. > > > > > > > > ---------------------------------------------------The > information > > > in > > ARCGIS > > > after projecting the dataset------- > > > Geometry Type: Point > > > > > > *Geographic Coordinate System:* #specify the coordinate system > > > GCS_Xian_1980 > > > Datum: D_Xian_1980 > > > Prime Meridian: 0 > > > > > > *Projected Coordinate System:* Xian_1980_3_Degree_GK_CM_117E > #specify > > the > > > projection method > > > Projection: Gauss_Kruger > > > False_Easting: 500000.00000000 > > > False_Northing: 0.00000000 > > > Central_Meridian: 117.00000000 > > > Scale_Factor: 1.00000000 > > > Latitude_Of_Origin: 0.00000000 > > > Linear Unit: Meter (1.000000) > > > > > > ---------------------------------------------------------------------- > > ------------------------------------------------------ > > > mapproject(x, y, projection="", parameters=NULL, > > orientation=NULL) *#only > > > allows us to define the projected coordinate system Anybody knows > > > how to finish it in R? Maybe rgdal() can it, but it's a > > liitle > > > difficult for me*. > > > > > > *Example of my dataset:* > > > > > > ID CLASS SOILTEM AIRTEM GHEIGHT H *LAT LONG* > > > 1 1 19 20 50 30.61688 117.4140 > > > 2 1 19 21 65 30.61686 117.4140 > > > 3 2 20 22 55 30.61680 117.4139 > > > 4 3 20 26 10 30.61675 117.4139 > > > 5 4 20 23 75 30.61679 117.4140 > > > 6 1 21 21 55 30.61685 117.4141 > > > > > > BTW, when i load the package rgdal, the following errors > > > appear,*where > > is > > > the wrong*? Does it mean i need to use the R2.4.0 version? > > > error in load(dataFile, ns) : ReadItem > uncorrect:no class 25 > > > Warning message: > > > package'rgdal'is build with R2.4.0 > > > error: package'rgdal' R's input code fail > > > error: 'rgdal'package/name space load fail, > > > -------------------------------package information > > > ---------------------------- > > > R : Version 2.3.1 (2006-06-01) > > > rgdal_0.5-1 > > > --------------------------------------------- > > > > > > > > > > -- > > 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: [EMAIL PROTECTED] > > > > > > > -- > With Kind Regards, > > oooO::::::::: > (..)::::::::: > :\.(:::Oooo:: > ::\_)::(..):: > :::::::)./::: > ::::::(_/:::: > ::::::::::::: > [************************************************************* > ********** > ] > Zhi Jie,Zhang ,PHD > Tel:86-21-54237149 [EMAIL PROTECTED] > Dept. of Epidemiology,school of public health,Fudan University > Address:No. 138 Yi Xue Yuan Road,Shanghai,China > Postcode:200032 > [************************************************************* > ********** > ] > oooO::::::::: > (..)::::::::: > :\.(:::Oooo:: > ::\_)::(..):: > :::::::)./::: > ::::::(_/:::: > ::::::::::::: > > [[alternative HTML version deleted]] > > > > ------------------------------ > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > > > End of R-sig-Geo Digest, Vol 40, Issue 9 > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo