[R-sig-Geo] converting bounding box to shapefile problem

mihai.niculita mihai.niculita at uaic.ro
Fri Jun 10 16:38:54 CEST 2011


Hy all,

I need to convert the bounding box of several rasters to shapefile. I wrote
a script starting from several scripts available over the Internet, and I am
stuck at the final command which should write the bounding box polygons
(contained in spatpoldf.list) obtained with sp package to shapefile using
rgdal:

> # export to a GIS format:
> write.list <- list()
> for(i in 1:length(spatpol.list[[i]])) {
+ write.list[[i]] <- writeOGR(spatpoldf.list[[i]], 
+ ".", layer=map.list[[i]], driver="ESRI Shapefile")
+ }
Error in writeOGR(spatpoldf.list[[i]], ".", layer = map.list[[1]], driver =
"ESRI Shapefile") : 
  number of objects mismatch
> 

map.list is a vector containing the raster names and looks like this:

[1] "N21W157.asc" "N21W158.asc" .....

I mention that the bounding box polygon does not have CRS because I can not
attach decimal degree coordinates with sp package. I really need the
Lat/Long coordinates because finally I must apply the script to a big number
of SRTM1 rasters which cover several UTM zones.

The entire script and the data is available at:
http://www.geomorphologyonline.com/script.r
http://www.geomorphologyonline.com/data.tgz

I work with R.2.12.1 x64 on Windows and I have the latest sp and rgdal for
x64.

Thank you in advance for any help with this!

--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/converting-bounding-box-to-shapefile-problem-tp6462495p6462495.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list