Tobias
Tobias

Reputation: 49

Converting coordinate ETRS89/LCC to WGS84 Lat Long

I need to convert a massive amount of coordinates in the ETRS89 format to WGS84 Lat Long.

As far as I know ETRS89 and WGS84 are nearly the same, but they have totally different values.

I need the WGS84 coordinates for bing maps.

Would be great if theres a simple solution in c# for this problem.

Thank you a lot :)

Upvotes: 1

Views: 3252

Answers (1)

Wernfried Domscheit
Wernfried Domscheit

Reputation: 59456

First choice for such transformation is the Proj4 project. There are several ports available, e.g. to Java (Java Proj.4), JavaScript (Proj4js), .NET (Proj4Net), etc.

Command-line tool cs2cs.exe is used to transform coordinates, the command would be like this:

cs2cs +init=epsg:3034 +to +init=epsg:4326 {name of your text-file containing massive amount of coordinates}

which is equivalent to

cs2cs +proj=lcc +lat_1=35 +lat_2=65 +lat_0=52 +lon_0=10 +x_0=4000000 +y_0=2800000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs 
    +to +proj=longlat +datum=WGS84 +no_defs {name of your text-file containing massive amount of coordinates}

In case you prefer C# my personal favorites are DotSpatial.Projections and ProjApi (file csharp-4.7.0.zip)

Example for DotSpatial:

double[] xy = new double[2];
xy[0] = 12345;
xy[1] = 67890;
double[] z = new double[1];
z[0] = 1;
ProjectionInfo pStart = KnownCoordinateSystems.Projected.Europe.ETRS1989LCC;
ProjectionInfo pEnd = KnownCoordinateSystems.Geographic.World.WGS1984;
Reproject.ReprojectPoints(xy, z, pStart, pEnd, 0, 1);

Example with Proj-API:

var src = new Projection(@"+proj=lcc +lat_1=35 +lat_2=65 +lat_0=52 +lon_0=10 +x_0=4000000 +y_0=2800000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"),
var dst = new Projection(@"+proj=longlat +datum=WGS84 +no_defs"))

double[] x = { -116, -117, -118, -119, -120, -121 };
double[] y = { 34, 35, 36, 37, 38, 39 };
double[] z = { 0, 10, 20, 30, 40, 50 };

Projection.Transform(src, dst, x, y);

Upvotes: 1

Related Questions