[R-sig-Geo] proj4 transform problem (Hungarian EOV CRS)

Bálint Czúcz elatine at gmail.com
Mon Jun 19 18:50:29 CEST 2006


Dear R-Sig-Geo readers!

I am trying to integrate spatial data given in the Hungarian EOV CRS
with lonlat data, but I am having problems with the coordinate
transformations.

I found this proj4string on the net:
+proj=somerc +lat_0=47.14439372222222 +lon_0=19.04857177777778
+alpha=90 +k=0.99993 +x_0=650000 +y_0=200000 +ellps=GRS67 +units=m
+no_defs +towgs84=+57.01,-69.97,-9.29

Using this string I get an error message:
> test <- matrix(c(5,1,5,2,6,2,6,1,5,1)*100000, ncol=2, byrow=TRUE)
> test <- SpatialPolygons(list(Polygons(list(Polygon(test)),ID=1)))
> proj4string(test) <- CRS("+proj=somerc +lat_0=47.14439372222222 +lon_0=19.04857177777778 +alpha=90 +k=0.99993 +x_0=650000 +y_0=200000 +ellps=GRS67 +units=m +no_defs +towgs84=+57.01,-69.97,-9.29")
> test2 <- transform(test, CRS=CRS("+proj=longlat +datum=wgs84"))
Error in transform_Polygon(input[[i]], to_args = to_args, from_args =
from_args) :
	no arguments in initialization list

The other direction does not work either:
> ceu <- map("worldHires", plot = FALSE, xlim = xl, ylim = yl)
> ceu <- pruneMap(ceu, xlim = xl, ylim = yl)
> ceu.sp <- map2SpatialLines(ceu, proj4string = CRS("+proj=longlat +datum=wgs84"))
> ceu2 <- transform(ceu.sp, CRS=CRS("+proj=somerc +lat_0=47.14439372222222 +lon_0=19.04857177777778 +alpha=90 +k=0.99993 +x_0=650000 +y_0=200000 +ellps=GRS67 +units=m +no_defs +towgs84=+57.01,-69.97,-9.29"))
Error in transform_Line(input[[i]], to_args = to_args, from_args = from_args) :
	unknown elliptical parameter name

In spite of this the proj4string seems to work OK with the same
projection string and the command line cs2cs utility:
ba:~$ cs2cs +proj=somerc +lat_0=47.14439372222222
+lon_0=19.04857177777778 +alpha=90 +k=0.99993 +x_0=650000 +y_0=200000
+ellps=GRS67 +units=m +no_defs +towgs84=+57.01,-69.97,-9.29   +to
+proj=latlong +datum=WGS84
0 0
10d47'15.654"E  45d2'9.093"N 46.348
650000 200000
19d2'50.836"E   47d8'38.85"N 36.882
...

What can be the problem?
(NB: EOV is a swiss-type oblique mercator projection: can this cause problems?)
Have I forgotten about something?

Thank you for your help!
Bálint


> sessionInfo()
R version 2.2.1, 2005-12-20, i586-uhu-linux-gnu

attached base packages:
[1] "datasets"  "graphics"  "grDevices" "methods"   "stats"     "utils"
[7] "base"

other attached packages:
  spproj   spmaps  mapdata     maps maptools       sp    gstat  foreign
 "0.3-4"  "0.1-3" "2.0-17" "2.0-31" "0.5-12" "0.8-14" "0.9-23" "0.8-12"
    ROCR   gplots    gdata   gtools    rpart      JGR   JavaGD    rJava
 "1.0-1"  "2.2.0"  "2.1.2"  "2.2.3" "3.1-27" "0.1-10"  "0.3-2"  "0.3-4"


-- 
Czúcz Bálint
PhD hallgató
BCE KTK Talajtan és Vízgazdálkodás Tanszék
1118 Budapest, Villányi út 29-43.




More information about the R-sig-Geo mailing list