Skip to content
Prev 6080 / 29559 Next

spTransform: wrong results??

Roger,

First at all, I think that the problem is solved.
Note that I was setting the CRS in QGIS, thus it is unequivocally
specified as EPSG 23031, then read into R through readOGR()

Anyway, the problem is that I was setting the towgs84 field as:
proj4string(wpcast300SPDF) <- CRS(paste(" +proj=utm +zone=31 +ellps=intl 
+units=m +towgs84=-84 -107 -120 +no_defs"))

while it must be:
proj4string(wpcast300SPDF) <- CRS(paste(" +proj=utm +zone=31 +ellps=intl 
+units=m +towgs84=-84,-107,-120 +no_defs"))

Note the "," !!!

With this I get:

Origianl point set in QGIS UTM 31N ED50
POINT(449919.586269 4631874.109627)	

TRANSFORMS TO LONGITUDE,LATITUDE:

Official reference (on-line tool of the Catalan Institute of Cartography)
ICC WGS84 2.395717586,41.835328397

GlobalMapper  ED50  2.39686371? E	41.83643863? N
GlobalMapper  WGS84 2.39572870? E	41.83535625? N

R (spTransform() in rgdal)
ED50 no towgs84 field specified
WP1	2.39686370617169	41.8364386271064

WGS84 no towgs84 field specified
WP1	2.39686370617169	41.8364386271064

WGS84 with towgs84=-87, -98,-121
(http://earth-info.nga.mil/GandG/coordsys/onlinedatum/CountryEuropeTable.html)
WP1  2.395729  41.83536

WGS84 with towgs84=-84,-107,-120
(http://www.asprs.org/resources/grids/)
WP1  2.395619  41.83535

The equivalent syntax in cs2cs:
cs2cs -v -f "%.9f" +init=epsg:23031 +towgs84=-87,-98,-121 +to 
+init=epsg:4326

provides identical output

Also note that the parameters found in http://earth-info.nga.mil
are closer to ICC output and identical to GlobalMapper output

I think that without the "," spTransform() was probably using just
the first parameter.

Thanks for your help!

Agus
Roger Bivand wrote: