Re: [R-sig-Geo] subsetting polygon display

2010-11-01 Thread Peter Larson
Lyndon/Edzer, Excellent! So simple and thank you for all your help. Thanks you! Pete On 11/1/10, Edzer Pebesma wrote: > if object states is of class "SpatialPolygons" or of class > "SpatialPolygonsDataFrame", use > > plot(states[1,]) > > you can find out by asking > > class(states) > > On 11/0

Re: [R-sig-Geo] subsetting polygon display

2010-11-01 Thread Edzer Pebesma
if object states is of class "SpatialPolygons" or of class "SpatialPolygonsDataFrame", use plot(states[1,]) you can find out by asking class(states) On 11/01/2010 07:42 PM, Peter Larson wrote: > Hello all, > > This is probably a completely stupid question, but how does one subset > a polygon d

[R-sig-Geo] subsetting polygon display

2010-11-01 Thread Peter Larson
Hello all, This is probably a completely stupid question, but how does one subset a polygon data set for display? I have a file of states of a country and just want to display one of them. Pete ___ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch ht

Re: [R-sig-Geo] subsetting a SpatialGridDataFrame image.SpatialGridDataFrame

2010-08-14 Thread Edzer Pebesma
On 08/13/2010 03:33 PM, Patrick Giraudoux wrote: > Thank you both, that is very clear now. SpatialPixelsDataFrame objects > can be "indexed" as a data frame, but not SpatialGridDataFrame where > row, col, band must be specified (thanks also not to have written, > please read the doc, which was a

Re: [R-sig-Geo] subsetting a SpatialGridDataFrame image.SpatialGridDataFrame

2010-08-13 Thread Patrick Giraudoux
Thank you both, that is very clear now. SpatialPixelsDataFrame objects can be "indexed" as a data frame, but not SpatialGridDataFrame where row, col, band must be specified (thanks also not to have written, please read the doc, which was all what I deserved..) Actually, my question was simpli

Re: [R-sig-Geo] subsetting a SpatialGridDataFrame image.SpatialGridDataFrame

2010-08-13 Thread Nikhil Kaza
you mean > chinatemput...@data[idx,] ? If you want to subset the grid itself, look at the examples for SpatialGridDataFrame class # the following is weird, but illustrates the concept of row/col selection: data(meuse.grid) # only the non-missing valued cells fullgrid(meuse.grid) = TRUE imag

Re: [R-sig-Geo] subsetting a SpatialGridDataFrame image.SpatialGridDataFrame

2010-08-13 Thread Roger Bivand
On Fri, 13 Aug 2010, Patrick Giraudoux wrote: Hi, I am trying to subset a SpatialGridDataFrame object as following: idx<-chinatemput...@data[,1]>10 # select elements of column1 whose values are > 10 idx[is.na(idx)]<-FALSE # make a vector of class "logical" (replacing NA by FALSE) and thi

[R-sig-Geo] subsetting a SpatialGridDataFrame image.SpatialGridDataFrame

2010-08-13 Thread Patrick Giraudoux
Hi, I am trying to subset a SpatialGridDataFrame object as following: idx<-chinatemput...@data[,1]>10 # select elements of column1 whose values are > 10 idx[is.na(idx)]<-FALSE # make a vector of class "logical" (replacing NA by FALSE) and this gives: ChinaTempUTM47[idx,] Error in ChinaTem

[R-sig-Geo] subsetting shapefile polygons with separate table criteria

2010-01-06 Thread Noli Sicad
# Subseting shapefile before merging tables - join table I realised that deleting the polygon with does match wit the record is not possible since, I can read the shapefile at all. But still I need to know how to delete / subset polygons. I think this is more workable. 1. Read shapefile polygons

Re: [R-sig-Geo] subsetting Spatial*DataFrame

2009-07-03 Thread Edzer Pebesma
Thanks, Augusting for pointing out a flaw in the [ methods for Spatial*DataFrames. To be really honest, I didn't even know that you could select rows by ID this way. After 16 years of using S! I'll look into it when I get the chance; this may however take (quite) a while. -- Edzer Agustin Lobo wr

[R-sig-Geo] subsetting Spatial*DataFrame

2009-07-03 Thread Agustin Lobo
I apologize for raising the same topic from time to time, but each time I have to subset Spatial*DataFrame objects (where * stands for polygons, lines or points) I get some problems. Last year Roger was kindly advising: "Just think of Spatial*DataFrame objects as data.frame objects and things wi

[R-sig-Geo] subsetting SpatialGridDataFrame

2009-05-18 Thread milton ruser
Dear all, I have a SpatialGridDataFrame which I read from grass myrast<-readRAST6("DRENVAL") Now I attrib a sequential number for each pixel with: myrast @ data[[1]]<-1:dim(myrast @ data)[1] Now I need to select record by record, from 1 to N, get the bbox() from each record, set the g.reg

Re: [R-sig-Geo] Subsetting a spatial grid

2008-12-11 Thread Edzer Pebesma
For SpatialGridDataFrames, row and col selection can be done by object[firstrow:lastrow, firstcol:lastcol,] after the last , you can optionally select attributes. -- Edzer Rob Robinson wrote: Help - please! :-) I have what I thought was a really simple problem. I have a raster image of satell

Re: [R-sig-Geo] Subsetting a spatial grid

2008-12-10 Thread rick reeves
The following R example might be a bit off-topic, but it does show how to create a point grid and then use it to extract samples from an underlying set of vector polygons. The vector polygon data could probably be replaced by a raster grid. Though not a very big one, given R's memory limitation

Re: [R-sig-Geo] Subsetting a spatial grid

2008-12-10 Thread Dylan Beaudette
On Wednesday 10 December 2008, Rob Robinson wrote: > Help - please! :-) > I have what I thought was a really simple problem. I have a raster image > of satellite data from which I would like to extract an arbitrary (but > simple rectangular) portion for subsequent analysis (which I'll need to do >

[R-sig-Geo] Subsetting a spatial grid

2008-12-10 Thread Rob Robinson
Help - please! :-) I have what I thought was a really simple problem. I have a raster image of satellite data from which I would like to extract an arbitrary (but simple rectangular) portion for subsequent analysis (which I'll need to do for many images). I have the data as a (projected) SpatialGr

Re: [R-sig-Geo] subsetting

2008-10-27 Thread Dylan Beaudette
_0=250, > > Y_0=0, OUT_GRID="dem25m_ll.sgrd", TARGET_TYPE=0, INTERPOLATION=1, > > [EMAIL PROTECTED]@cellsize[[1]])) > > # unfortunately this does not work because I am not able to define the > correct geodetic datum (dX, dY, dZ) for baranja hill dataset > (http://g

Re: [R-sig-Geo] subsetting

2008-10-27 Thread Hengl, T.
geodetic datum (dX, dY, dZ) for baranja hill dataset (http://geomorphometry.org/data.asp) in SAGA, so I get an empty grid! Unfortunately SAGA does not (yet!) support EPSG codes, so that the choice of coordinate systems is relatively limited. Tom Hengl http://spatial-analyst.net/wiki/index.php?t

Re: [R-sig-Geo] subsetting

2008-10-24 Thread Dylan Beaudette
2]],") >> -pixsize=",[EMAIL PROTECTED]@cellsize[[1]],sep=""), wait=F) >> >>> >>> shell(cmd=paste(ILWIS, "dem25m_ll_c.mpr = MapResample(dem25m_c.mpr, >>> geoarc, BiLinear)"), wait=F) >>> shell(cmd=paste(ILWIS

Re: [R-sig-Geo] subsetting

2008-10-24 Thread Edzer Pebesma
n dem25m_ll_c.mpr -noask"), wait=F) see http://geomorphometry.org/R.asp hth, Tom Hengl http://spatial-analyst.net -Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pieter Beck Sent: Thursday, October 23, 2008 9:15 PM To: r-sig-geo@stat.math.eth

Re: [R-sig-Geo] subsetting

2008-10-24 Thread Edzer Pebesma
Pieter, the easiest in terms of the least mental exercise might be to form a polygon from the four points and then overlay that with the grid. This will likely be too slow and/or memory intensive. The more efficient way would be to compute the row and column index ranges from the bounding box, a

Re: [R-sig-Geo] subsetting

2008-10-24 Thread Tomislav Hengl
Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pieter Beck Sent: Thursday, October 23, 2008 9:15 PM To: r-sig-geo@stat.math.ethz.ch Subject: [R-sig-Geo] subsetting Dear all, I am a new user to the world of spatial applications of R and am wondering about this triv

Re: [R-sig-Geo] subsetting

2008-10-24 Thread Tomislav Hengl
CTED]@cellsize[[1]],sep=""), wait=F) > shell(cmd=paste(ILWIS, "dem25m_ll_c.mpr = MapResample(dem25m_c.mpr, geoarc, > BiLinear)"), wait=F) > shell(cmd=paste(ILWIS, "open dem25m_ll_c.mpr -noask"), wait=F) see http://geomorphometry.org/R.asp hth, Tom Hengl http://

Re: [R-sig-Geo] subsetting

2008-10-24 Thread Paul Hiemstra
Hi, Which version of R and sp are you using? I'm asking this because I had a similar problem as you had with a raster of 50.000+ points and some 7000 polygons (not sure if this is comparable to your dataset). Doing the overlay took far too long, but after a question about this to the r-sig-ge

[R-sig-Geo] subsetting

2008-10-23 Thread Pieter Beck
Dear all, I am a new user to the world of spatial applications of R and am wondering about this trivial question: What is the easiest way to subset a SpatialGridDataFrame, based on 4 corner coordinates? The reason I ask is that I want to do an overlay of a polygon file on a large raster datas

Re: [R-sig-Geo] Subsetting a point process based on a grid of square owins

2008-04-16 Thread Marcelino de la Cruz
Hi, I've got this experimental function "gridppp". You have to especify the required "lag" of the grid (i.e. the desired length of the x-side or the y-side of each cell in the grid). It gives you a list of point patterns of the required size. Example of use: data (lansing) plot(lansing) axis

[R-sig-Geo] Subsetting a point process based on a grid of square owins

2008-04-15 Thread Honey Giroday
Hi, I am currently using R 2.5.1 on a linux operating system (I am connected to the linux system via remote desktop connection). I am trying to estimate nuiscance parameters for a Geyer model that will be fit to a spatial point process dataset with ~10,000 points. However, R reaches its vect

[R-sig-Geo] Subsetting shapefile type PolyLine

2008-02-04 Thread Rafael Duarte
Dear all, I am very new to SIG. This is probably a very simple question but I could not find an answer searching the web and the R-SIG emails archive. I have an ESRI shapefile with a coast and bathymetric lines. In the dbf file I have a column “ELEVATION” that gives this information. I import

Re: [R-sig-Geo] Subsetting SpatialPolygonsDataFrame and empty ID slots

2007-10-30 Thread Roger Bivand
On Tue, 30 Oct 2007, Agustin Lobo wrote: That's really helpful, thanks. For "everyday" use, I've made: "slotspol" <- function(pol, sl="ID") sapply(slot(pol, "polygons"), function(x) slot(x, sl)) Which can be used for any slot name: slotspol(Up) slotspol(Up,"area") Also, few questions: 1. I o

Re: [R-sig-Geo] Subsetting SpatialPolygonsDataFrame and empty ID slots

2007-10-30 Thread Agustin Lobo
That's really helpful, thanks. For "everyday" use, I've made: "slotspol" <- function(pol, sl="ID") sapply(slot(pol, "polygons"), function(x) slot(x, sl)) Which can be used for any slot name: slotspol(Up) slotspol(Up,"area") Also, few questions: 1. I observe that pols$Site is identical to [EMAIL

Re: [R-sig-Geo] Subsetting SpatialPolygonsDataFrame and empty ID slots

2007-10-29 Thread Roger Bivand
On Mon, 29 Oct 2007, Agustin Lobo wrote: > Dear list, > > I have imported a shp file with: > >> pols <- readOGR("../AllTransectPolygons02", > layer="AllTransectPolygons02") > >> class(pols) > [1] "SpatialPolygonsDataFrame" > attr(,"package") > [1] "sp" > >> [EMAIL PROTECTED] > AREA PERIMETER

[R-sig-Geo] Subsetting SpatialPolygonsDataFrame and empty ID slots

2007-10-29 Thread Agustin Lobo
Dear list, I have imported a shp file with: > pols <- readOGR("../AllTransectPolygons02", layer="AllTransectPolygons02") > class(pols) [1] "SpatialPolygonsDataFrame" attr(,"package") [1] "sp" > [EMAIL PROTECTED] AREA PERIMETER Site 0 2500 1010 Lupuna 1 1 2

Re: [R-sig-Geo] Subsetting a spatial polygon dataframe with a for loop

2007-02-14 Thread Edzer J. Pebesma
I'm not a 100% sure, but it might be that you are using c(sub.cb.poly, i) which creates a list when the arguments are complicated structures. You may wish to use rbind on two (or more!) SpatialPolygonsDataFrame objects instead. Provided you have the latest sp from CRAN... Hth, -- Edzer Andrew

[R-sig-Geo] Subsetting a spatial polygon dataframe with a for loop

2007-02-14 Thread Andrew Niccolai
Hi. I had such great success last time, I thought I would ask for more assistance. I have an object (cb.poly) of class "SpatialPolygonsDataFrame". I would like to subset this object using a for loop that essentially loops through polygon ID from a larger list. The code looks like this: class(cb