我需要将ETRS89格式的大量坐标转换为WGS84 Lat Long。
据我所知,ETRS89和WGS84几乎相同,但它们的价值完全不同。
我需要用于bing贴图的WGS84坐标。
如果这个问题在c#中是一个简单的解决方案,那就太棒了。
非常感谢你:)
答案 0 :(得分: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.Projections和ProjApi(文件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);