【问题标题】:NetTopologySuite convert coordinates to another coordinate systemNetTopologySuite 将坐标转换为另一个坐标系
【发布时间】:2017-07-11 13:06:04
【问题描述】:

我正在尝试使用 NetTopologySuite 将我的坐标转换为不同的坐标系。但我无法让它工作。我最初的转换是从 WGS84 转到 Lambert72。

我在 stackoverflow 的某个地方找到了这个示例,但我无法让它工作:

public static double CalculateDistance(this MvxCoordinates baseLocation, double targetLat, double targetLon)
    {
        CoordinateSystemFactory csFact = new CoordinateSystemFactory();
        CoordinateTransformationFactory ctFact = new CoordinateTransformationFactory();

        ICoordinateSystem utm35ETRS = Coo.CreateFromWkt(
            "PROJCS[\"ETRS89 / ETRS-TM35\",GEOGCS[\"ETRS89\",DATUM[\"D_ETRS_1989\",SPHEROID[\"GRS_1980\",6378137,298.257222101]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",27],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"Meter\",1]]");

        IProjectedCoordinateSystem utm33 = ProjectedCoordinateSystem.WGS84_UTM(33, true);

        ICoordinateTransformation trans = ctFact.CreateFromCoordinateSystems(utm35ETRS, utm33);

        Coordinate[] points = new Coordinate[]
        {
            new Coordinate(290586.087, 6714000), new Coordinate(290586.392, 6713996.224),
            new Coordinate(290590.133, 6713973.772), new Coordinate(290594.111, 6713957.416),
            new Coordinate(290596.615, 6713943.567), new Coordinate(290596.701, 6713939.485)
        };

        //Coordinate[] tpoints = trans.MathTransform.TransformList(points).ToArray();
        //for (int i = 0; i < points.Length; i++)
        //    Assert.That(tpoints[i].Equals(trans.MathTransform.Transform(points[i])));
    }

这段代码最大的问题是它使用了 ProjNET4GeoAPI,这与 Xamarin 核心项目不兼容

【问题讨论】:

    标签: xamarin nettopologysuite


    【解决方案1】:

    ProjNet4GeoAPI 的最新预发布版现在支持 .NET Standard 1.0 和 .NET Standard 2.0 目标。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-03-25
      • 1970-01-01
      • 2013-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多