[R-sig-Geo] Coordination Transformation from Gauss Kruger to LongLat

Johannes Radinger JRadinger at gmx.at
Mon Jan 30 13:30:45 CET 2012


Dear List,

due to recent mails on this list about sptransform and ptransform
and the different packages proj4 and gdal I found the solution.
As I am new in this field of R and Geo-data I got confused by these
two packages proj4 and gdal.

For me the gdal package seems to be the right one.
Here my successful code and I am really happy so far as it works:

# Creating data
Species <- c("A","B","C")
X_GK <- c(3518665,3523424,3525506)
Y_GK <- c(6052307,6040485,6042275)
df <- data.frame(Species,X_GK,Y_GK)

#Spatial Information, Coordinates Transform
coordinates(df) <- c("X_GK", "Y_GK")
proj4string(df) <- CRS("+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs") # Defining Gauss Krüger
df.WGS84 <- spTransform(df, CRS("+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0")) # tranforming to WGS84 longlat



best regards,
Johannes


-------- Original-Nachricht --------
> Datum: Fri, 27 Jan 2012 12:46:35 +0100
> Von: "Johannes Radinger" <JRadinger at gmx.at>
> An: r-sig-geo at r-project.org
> Betreff: [R-sig-Geo] Coordination Transformation from Gauss Kruger to LongLat

> Dear R-Geo List!
> 
> This is my first post on this list as I have a geographical task/problem
> to solve. 
> I want to perform Species Distribution Models (SDM) and therefore
> I have the points of occurence of several Species.
> Unforunately all the environmental maps (climatic maps etc.) are in
> long-lat projection but my points are in the German Gauss Krüger System.
> So I have to transform the points correctly but I don't know how exactly
> that works.
> 
> I compiled a sample script of what I did so far:
> 
> Species <- c("A","B","C")
> X_GK <- c(3518665,3523424,3525506)
> Y_GK <- c(6052307,6040485,6042275)
> 
> df <- data.frame(Species,X_GK,Y_GK) # That's how my occurence points look
> like
> 
> 
> #library(proj4)
> 
> # reassemble coordinates as matrix (don't know it that is really necessary
> # or if I can work with the orig. dataframe)
> 
> coord_GK <- cbind(df$X_GK, df$Y_GK)
> coord_longlat <- transform(coord_GK,'+proj=tmerc +ellps=?','+proj=latlong
> +ellps=sphere') # Here I don't know what I have to specify, or if that
> method is the one to use?
> 
> I am working on R.2.14.1 on Windows and Mac.
> 
> 
> Maybe someone of you can help me in this case as I am not a geographer nor
> a professional R user at all...
> 
> Thanks!
> 
> best regards,
> Johannes Radinger
> 
> -- 
> "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Ihr GMX Postfach immer dabei: die kostenlose GMX Mail App für Android.
Komfortabel, sicher und schnell: www.gmx.de/android



More information about the R-sig-Geo mailing list