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
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
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
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
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
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
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
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
# 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
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
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
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
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
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
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
>
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
_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
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
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
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
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
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
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://
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
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
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
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
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
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
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
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
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
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
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
34 matches
Mail list logo