Home

Numerical modelation

Flow Models and fluid flow

Geosciences

Electronics

Network

Free utilities for windows

Gauss-Krueger to Geographical coordinates conversion with Matlab

This Matlab code permits the conversion from Gauss-Krueger to Geographical coordinates, It uses an iterative strategy, assuming that you already has the geo2gk.m file. Ellipsoid parameters can be changed with variables A1 and A2 (mayor and minor axis respectively) in the geo2gk.m file. L0 is the reference meridian in grades. It can be -999 to automatic selection. But it should be the same used to create the original GK coordinates, otherwise the convergence is not possible

 

function [ L,B ] = gk2geo( x0, y0, L0 )

lat=0;
lon=0;

delta=0.000001;

[x,y]=geo2gk(lon,lat,L0);
i=0;

  while (abs(x-x0)>0.0001 | abs(y-y0)>0.0001) & i <400
    if abs(x-x0)>0.0001
        lon=lon-delta*(x-x0);
    end
    if abs(y-y0)>0.0001
        lat=lat-delta*(y-y0);
    end
    [x,y]=geo2gk(lon,lat,L0);

    i=i+1;
  end
  L=lon;
  B=lat;

end 
Convert coordinate online