Hi all, I have a set of 54 files that I need to convert from ASCII grid
format to .shp files to .bnd files for BayesX.
I have the following R code to operate on those files:
library(maptools)
library(Grid2Polygons)
readfunct <- function(x)
{
u <- readAsciiGrid(x)
}
modfilesmore <- paste0("MaxFloodDepth_", 1:54, ".txt")
modeldepthsmore <- lapply(modfilesmore, readfunct)
maxdepth.plys <- lapply(modeldepthsmore, Grid2Polygons(modeldepthsmore,
level = FALSE))
layers <- paste0("examples/floodlayers_", 1:54)
writePolyShape(maxdepth.plys, layers)
shpName <- sub(pattern="(.*)\\.dbf", replacement="\\1",
x=system.file("examples/Flood/layer_.dbf", package="BayesX"))
floodmaps <- shp2bnd(shpname=shpName, regionnames="SP_ID")
## draw the map
drawmap(map=floodmaps)
This is the error message that I receive:
> maxdepth.plys <- lapply(modeldepthsmore,
Grid2Polygons(modeldepthsmore, level = FALSE))
Error in Grid2Polygons(modeldepthsmore, level = FALSE) :
Grid object not of class SpatialGridDataFrame
Can someone assist me in modifying the R code so that I can convert the
set of files to .shp files?
Thank-you.
Irucka Embry
<span id=m2wTl><p><font face="Arial, Helvetica, sans-serif" size="2"
style="font-size:13.5px">_______________________________________________________________<BR>Get
the Free email that has everyone talking at <a href=http://www.mail2world.com
target=new>http://www.mail2world.com</a><br> <font color=#999999>Unlimited
Email Storage – POP3 – Calendar – SMS – Translator –
Much More!</font></font></span>
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo