[R-sig-Geo] readGDAL loses datum

Oliver Soong osoong+r at gmail.com
Sat Nov 3 20:33:40 CET 2012


I did notice another thing.  I've attached the .prj file I've been
using along with a raster exported in that projection using ArcGIS.

> system("gdalinfo -proj4 Arc.tif")
[...]
PROJ.4 string is:
'+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0
+datum=NAD83 +units=m +no_defs '
[...]
> readGDAL("Arc.tif")@proj4string
CRS arguments:
 +proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0
+datum=NAD83
+units=m +no_defs +ellps=GRS80 +towgs84=0,0,0

There are similar issues with extra Proj4 parameters showing up with
+proj=longlat +datum=WGS84 +no_defs, although these seem to be added
on read and stripped on write, somehow.

wgs84_1 <- SpatialGridDataFrame(GridTopology(c(0, 0), c(1, 1), c(1,
1)), data.frame(band = 1), CRS("+proj=longlat +datum=WGS84 +no_defs"))
writeGDAL(wgs84_1, "wgs84_1.tif")
system("gdalinfo -proj4 wgs84_1.tif")
wgs84_2 <- readGDAL("wgs84_1.tif")
wgs84_2 at proj4string
writeGDAL(wgs84_2, "wgs84_2.tif")
system("gdalinfo -proj4 wgs84_2.tif")

Any idea where the extra +ellps +towgs84 terms are coming from?

Oliver
-------------- next part --------------
A non-text attachment was scrubbed...
Name: attachments.zip
Type: application/zip
Size: 1045 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20121103/1e8e9702/attachment.zip>


More information about the R-sig-Geo mailing list