Gauss-Krüger coordinates system

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Gauss-Krüger coordinates system

Giannitrapani, Marco GSUK-GSSC
Dear All,

I need to convert some Northing-Easting coordinates from the Gauss-Krüger system into latitude-longitude.

Any suggestions on how to do it?

Regards,

Marco





Marco Giannitrapani
Statistical Consultant



Tel: +44151373 5945
Email:
Internet: http://www.shell.com


        [[alternative HTML version deleted]]


______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Gauss-Krüger coordinates system

Roger Bivand
On Wed, 1 Feb 2006, Giannitrapani, Marco GSUK-GSSC wrote:

> Dear All,
>
> I need to convert some Northing-Easting coordinates from the
> Gauss-Krüger system into latitude-longitude.
>
> Any suggestions on how to do it?

(The "Spatial" Task View on CRAN and/or the R-sig-geo mailing lists might
have helped).

Yes, the off-CRAN package spproj using classes from the sp package and the
underlying PROJ.4 projection library should be able to do it:

rSpatial <- "http://r-spatial.sourceforge.net/R"
install.packages("spproj", repos=rSpatial)

# if you don't have it already; on Mac OSX and Linux/Unix, you need to
# install PROJ.4 first; on Windows the binary package should install OK

library(spproj)

lon <- 2*runif(20)+9
lat <- 2*runif(20)+50
coords <- cbind(lon, lat)

# generate some coordinates

coords_sp <- SpatialPoints(coords,
 proj4string=CRS("+proj=longlat +ellps=WGS84"))
plot(coords_sp, axes=TRUE)

coords_sp_GK <- transform(coords_sp, CRS("+init=epsg:2166"))
plot(coords_sp_GK, axes=TRUE)

#
# and make them Pulkovo 1942(83) / Gauss Kruger zone 3 (see
# system.file("proj/epsg", package="spproj")[1]
# for PROJ.4 definitions of thousands of projections
#
# EPSG was founded and funded by oil companies fed up with
# projection metadata being treated as top secret, and it seems to
# be well-maintained
#
# The first argument to transform() must be a "Spatial" class object
# with its proj4string slot set to the appropriate projection.
# If you set it wrong, you may be surprised/disappointed
#

coords_sp_LL <- transform(coords_sp_GK, CRS("+proj=longlat +ellps=WGS84"))

# and back again (your question) for your choice of datum and/or ellipsoid

all.equal(slot(coords_sp_LL, "coords"), slot(coords_sp, "coords"))

Roger

>
> Regards,
>
> Marco
>
> Marco Giannitrapani
> Statistical Consultant

--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Roger Bivand
Department of Economics
NHH Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway