[R-sig-Geo] distmap of polylines

2009-03-27 Thread Tyler Dean Rudolph
The answer I have found is both clear and straightforward: require(maptools) IloveR<-as(as(readShapeLines(fn="mylinedata.shp"), "SpatialLines"), "psp") I was hoping someone might be able to point me in the direction of something like this but I was fortunate enough to stumble across it in one of

[R-sig-Geo] distmap of polylines

2009-03-26 Thread Tyler Dean Rudolph
Hi there, I have a spatial road network for which I would like to construct a "distance map" as in the distmap() function in the spatstat package. However this function only seems to readily accept .ppp, .psp, and owin objects. How can I import my data into a format that can be used to create a d

[R-sig-Geo] distmap for polygons imported from shapefiles

2007-08-13 Thread Agustin Lobo
The distmap calculation works fine for polygons imported from shapefiles, thanks Adrian and Roger! Agus Roger Bivand escribió: > > Doing all the conversions as specified, it does work: > > library(maptools) > library(spatstat) > load("refG.rda") #Note, refG comes from: #refG <- #readOGR("C:/A

[R-sig-Geo] Distmap Inconsistency?

2007-07-22 Thread Agustin Lobo
Dear list, I have 2 raster (im) objects (ai and escenai) which are identical except by 1 single pixel at position 356,777: > ai$v[356,777] [1] 255 > escenai$v[356,777] [1] NA I calculate distmap for both: refdist <- distmap(as.owin(ai)) adist630 <- distmap(as.owin(escenai)) As the only diffe

[R-sig-Geo] Distmap: the way I could do it

2007-07-10 Thread Agustin Lobo
Finally, I've given up using distmap on an object imported from a shp file. Could not solve the casting problem from the sp object to the owin object. I've rasterized the vector prior to importing to R and this is the way I calculate the distmap and export it. refG25 <- readGDAL("GFOEOABUFActi25.

Re: [R-sig-Geo] distmap

2007-06-27 Thread Roger Bivand
On Tue, 26 Jun 2007, Agustin Lobo wrote: Still some problems: sessionInfo() R version 2.5.0 (2007-04-23) i386-pc-mingw32 locale: LC_COLLATE=Spanish_Spain.1252;LC_CTYPE=Spanish_Spain.1252;LC_MONETARY=Spanish_Spain.1252;LC_NUMERIC=C;LC_TIME=Spanish_Spain.1252 attached base packages: [1] "sta

Re: [R-sig-Geo] distmap

2007-06-26 Thread Agustin Lobo
Still some problems: > sessionInfo() R version 2.5.0 (2007-04-23) i386-pc-mingw32 locale: LC_COLLATE=Spanish_Spain.1252;LC_CTYPE=Spanish_Spain.1252;LC_MONETARY=Spanish_Spain.1252;LC_NUMERIC=C;LC_TIME=Spanish_Spain.1252 attached base packages: [1] "stats" "graphics" "grDevices" "utils"

Re: [R-sig-Geo] distmap

2007-06-26 Thread Roger Bivand
On Mon, 25 Jun 2007, Edzer J. Pebesma wrote: > Roger Bivand wrote: >> On Mon, 25 Jun 2007, Agustin Lobo wrote: >> >> > I've tried (among other things): >> > > limit1 <- read.shape("limit_PNSN2000.shp") >> > Shapefile type: Polygon, (5), # of Shapes: 2 >> > > limit1poly <- Map2poly(limit1)

Re: [R-sig-Geo] distmap

2007-06-25 Thread Edzer J. Pebesma
Roger Bivand wrote: > On Mon, 25 Jun 2007, Agustin Lobo wrote: > >> I've tried (among other things): >>> limit1 <- read.shape("limit_PNSN2000.shp") >> Shapefile type: Polygon, (5), # of Shapes: 2 >>> limit1poly <- Map2poly(limit1) >>> limit1owin <- as(limit1poly,"owin") >> Error in .classEnv(thi

Re: [R-sig-Geo] distmap

2007-06-25 Thread Roger Bivand
On Mon, 25 Jun 2007, Agustin Lobo wrote: I've tried (among other things): limit1 <- read.shape("limit_PNSN2000.shp") Shapefile type: Polygon, (5), # of Shapes: 2 limit1poly <- Map2poly(limit1) limit1owin <- as(limit1poly,"owin") Error in .classEnv(thisClass) : unable to find an environment

Re: [R-sig-Geo] distmap

2007-06-25 Thread Agustin Lobo
I've tried (among other things): > limit1 <- read.shape("limit_PNSN2000.shp") Shapefile type: Polygon, (5), # of Shapes: 2 > limit1poly <- Map2poly(limit1) > limit1owin <- as(limit1poly,"owin") Error in .classEnv(thisClass) : unable to find an environment containing class "polylist" > limit2

Re: [R-sig-Geo] distmap

2007-06-24 Thread Roger Bivand
On Fri, 22 Jun 2007, Agustin Lobo wrote: > Dear sig-geos, > > I have to calculate a distmap (that is, a map > in which the value of each cell is the distance > from the cell to a given object) for a set of polygons. > It seems to me that distmap.owin in spatstat would do it > fine, but distmap.owi

[R-sig-Geo] distmap

2007-06-22 Thread Agustin Lobo
Dear sig-geos, I have to calculate a distmap (that is, a map in which the value of each cell is the distance from the cell to a given object) for a set of polygons. It seems to me that distmap.owin in spatstat would do it fine, but distmap.owin does not accept objects imported from shp vectors via