Skip to content
Prev 7623 / 29559 Next

R crash with readOGR

On Fri, 12 Feb 2010, caspar hallmann wrote:

            
OK. You are on Windows, where memory management is not as capable as on 
Unix-based systems. If R say that it cannot allocate memory under Windows, 
it has not "crashed", only responded to the inadequacy of the system. If 
you read the R for Windows FAQ, you'll see some tricks for improving 
memory use. A 42MB shapefile is very large, you have not said what you 
need to use it for.

The R lists posting guide does say when you can term anything a crash, 
this is not one of those cases.

There is no separate function for reading a *.prj file. The so-called WKT 
spatial reference in the *.prj is read by the OGR driver, and converted to 
PROJ.4.

"OGRSpatialRef" <- function(dsn, layer) {
     .Call("ogrP4S", as.character(dsn), as.character(layer),
         PACKAGE="rgdal")
}

is a function that will return that representation without trying to read 
the features, I'll add it and one for GDAL rasters to the next release - 
the GDAL information is already in the object returned by GDALinfo(), but 
noy yet in that returned by ogrInfo().

Hope this helps,

Roger