简体   繁体   中英

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. The problem - using available libraries (I use .NET nugets) like pro.net, after converting I have correct geometry, but completely wrong location.

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

to this: "long": 46.930562111606726, "lat": 23.173950579639786

but correct would be those: "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..."); 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

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?

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. Here is full description with example: https://www.codeproject.com/Tips/1072197/Coordinate-Transformation-Using-Proj-in.NET

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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