Skip to content
Prev 3442 / 29559 Next

readOGR and proj4 string

On Thu, 10 Apr 2008, Roger Bivand wrote:

            
OK, thanks. I can reproduce the problem. PROJ.4 does not support 
projection "names" as such, they are often not unique (same name but 
different parameters. In addition, ED50 is a collection of standards, not 
one standard. I suggest entering:

t1 <- CRS(paste("+proj=utm +zone=31 +ellps=intl",
  "+towgs84=-87.0,-98.0,-121.0,0.0,0.0,0.0,0.0")

manually. http://www.asprs.org/resources/grids/, July 200, gives different 
+towgs84= values. The ones in the file are prepended by a comma, which 
looks odd, but removing it doesn't help in parsing the file.

CRS("+init=epsg:23031")

is correct, but as usual with EPSG, no +towgs84= is given for ED50, 
because they vary so much.

So the underlying code in readOGR is erring on the side of caution - if 
the *.prj file cannot be interpreted unequivocally, return NA.

I set the value above:

x <- readOGR(".", "test_TNT")
proj4string(x) <- t1
x1 <- spTransform(x, CRS("+proj=longlat +datum=WGS84"))
writeOGR(x1, "x1.kml", "x1", driver="KML")

and viewed in Google Earth, things looked more-or-less OK. You could try 
the +towgs84 parameters from Grids & Datums and see if they fit better on 
the ground.

Hope this helps,

Roger