2016-07-06 335 views
0

我需要將ETRS89格式的大量座標轉換爲WGS84 Lat Long。將座標ETRS89/LCC轉換爲WGS84 Lat Long

據我所知,ETRS89和WGS84幾乎是一樣的,但它們有完全不同的值。

我需要WGS84座標bing地圖。

如果在這個問題的c#中有一個簡單的解決方案,將是偉大的。

謝謝了很多:)

回答

0

這種轉變首先選擇的是Proj4項目。有幾個端口可用,例如到Java(Java Proj.4),JavaScript的(Proj4js),.NET(Proj4Net)等

命令行工具cs2cs.exe用於轉化座標,該命令會是這樣:

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

這是相當於

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} 

如果你喜歡C#我個人最喜歡的是DotSpatial.ProjectionsProjApi(文件csharp-4.7.0.zip

示例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); 

實施例以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);