简体   繁体   English

将坐标从 Dealul Piscului 1970 坐标参考系转换为 wgs84

[英]Convert coordinates from Dealul Piscului 1970 coordinate reference system to wgs84

The goal is to convert polygons from obsolete Romanian Dealul Piscului 1970 coordinate reference system to WGS-84.目标是将多边形从过时的罗马尼亚 Dealul Piscului 1970 坐标参考系统转换为 WGS-84。 The problem - using available libraries (I use .NET nugets) like pro.net, after converting I have correct geometry, but completely wrong location.问题 - 使用像 pro.net 这样的可用库(我使用 .NET nugets),转换后我有正确的几何形状,但位置完全错误。

Here is code, which I tried to do a convertion:这是我尝试进行转换的代码:

string wkt25831 = "PROJCS[\"Dealul Piscului 1970/ Stereo 70\",GEOGCS[\"Dealul Piscului 1970\",DATUM[\"Dealul_Piscului_1970\",SPHEROID[\"Krassowsky 1940\",6378245,298.3],TOWGS84[28,-121,-77,0,0,0,0]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4317\"]],PROJECTION[\"Oblique_Stereographic\"],PARAMETER[\"latitude_of_origin\",46],PARAMETER[\"central_meridian\",25],PARAMETER[\"scale_factor\",0.99975],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",500000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"31700\"]]";

var gcsWgs84 = GeographicCoordinateSystem.WGS84;

var cf = new CoordinateSystemFactory();
var f = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
var sys32639 = cf.CreateFromWkt(wkt25831);

var transformTo3857 = f.CreateFromCoordinateSystems(sys32639, gcsWgs84);
double[] fromPoint = { latitude, longitude };
double[]? xy = transformTo3857.MathTransform.Transform(fromPoint);

return new CoordinatePoint(xy[0], xy[1]);

//please ignore that some names of fields may have not correct numbers, because I'm new in this area. //请忽略某些字段名称可能没有正确的数字,因为我是这方面的新手。

This code will convert from this coordinates: longtitude: 605057.24196916714, lattitude: 361091.237746394此代码将从以下坐标转换:经度:605057.24196916714,纬度:361091.237746394

to this: "long": 46.930562111606726, "lat": 23.173950579639786为此:“long”:46.930562111606726,“lat”:23.173950579639786

but correct would be those: "long": 26.325139519105466, "lat": 44.741816543663873但正确的是:“long”:26.325139519105466,“lat”:44.741816543663873

Let's say accuracy here isn't important, the point that shift so huge that instead of Romania the polygon somewhere in Luxemburg...假设这里的准确性并不重要,这个点移动得如此之大,以至于罗马尼亚不是卢森堡某处的多边形......

What I also tried - new CoordinateSystemFactory().CreateFromXml("...xml from epsg.io for 1970 crs...");我也尝试过 - new CoordinateSystemFactory().CreateFromXml("...xml from epsg.io for 1970 crs..."); but it throwing Not implemented exception.但它抛出未实现的异常。

Online translation doing this job correctly: https://epsg.io/transform#s_srs=31600&t_srs=4326&x=605057.2419692&y=361091.2377464在线翻译正确完成这项工作: https://epsg.io/transform#s_srs=31600&t_srs=4326&x=605057.2419692&y=361091.2377464

So my question - is it possible to do with pro.net or is there are any other way on how to manually convert coordinates (using math calculations) to get WGS84?所以我的问题 - 是否可以使用 pro.net 或者是否有任何其他方法可以手动转换坐标(使用数学计算)以获得 WGS84?

Ok, looks like I found working solution.好的,看起来我找到了可行的解决方案。 Unfortunately for me the ProjNet nuget didn't work as expected, but Proj4 did it's job well.不幸的是,ProjNet nuget 没有按预期工作,但 Proj4 做得很好。 Here is full description with example: https://www.codeproject.com/Tips/1072197/Coordinate-Transformation-Using-Proj-in.NET以下是带有示例的完整说明: https://www.codeproject.com/Tips/1072197/Coordinate-Transformation-Using-Proj-in.NET

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM