I am trying to calculate distance between two points using NetTopologySuite. Since I am referencing Microsoft documentation, I Came up with following GeometryExtension and GeometryHelper classes: public static class GeometryExtensions { private static readonly CoordinateSystemServices _coordinateSystemServices = new CoordinateSystemServices(new Dictionary<int, string> { // Coordinate systems: [4326] = GeographicCoordinateSystem.WGS84.WKT, // CRS for Denmark ESPG 25832. Source: […]

- Tags _longLatSRID).Distance(b.ProjectTo(targetSrid.Value, _longLatSRID)); } catch (Exception e) { throw new Exception("Failed to calculate distance, ""25832""]]" } ); /// /// Projects a geometry to another SRID /// /, ""6258""]], "7019"]], "8901"]], "9122"]], "North", // CRS for Denmark ESPG 25832. Source: https://epsg.io/25832 and https://sdfe.dk/ [25832] = @"PROJCS[""ETRS89 / UTM zone 32N", 0, 0.0174532925199433]]', 0.9996, 1, 12.546601114728679, 12.546625254609248, 12.546674114514795, 12.547258269821455, 12.56698376863065, 12.567203858066554, 15.68)]//I am getting 36.1 [InlineData(55.659368700924475, 298.257222101, 3.77)]//I am getting 6.2 [InlineData(55.65896978705746, 4258]], 4326 (longitude/latitude) is assumed. /// /// ///, 500000, 55.65940085355421, 55.6596855501795, 55.67645068023813, 6378137, 87.09)]//I am getting 173.7 public void DistanceInMeters(double x1, 9, 900;1, assume long/lat, AUTHORITY["EPSG", AXIS["easting", AXIS["northing", cannot project"); var sourceSrid = geometry.SRID == 0 && defaultSourceSrid.HasValue ? defaultSourceSrid.Value : geometry.SRID;, DATUM[""European_Terrestrial_Reference_System_1989"", double expected) { // setup Point point1 = new Point(x1, double x2, double y1, double y2, e); } } } To test if my distance is being calculated properly, East, GEOGCS[""ETRS89"", I am trying to calculate distance between two points using NetTopologySuite. Since I am referencing Microsoft documentation, I Came up with following GeometryExtension and GeometryHelper classes: public static class GeometryExtensions { private, I opened Google Maps and selected the calculate distance between 3 different pairs of points. Then I copy pasted the values in my tests to se, ie. 4326 return a.ProjectTo(targetSrid.Value, int targetSrid, int? defaultSourceSrid = null) { if (geometry == null) throw new Exception("Geometry is null, int? targetSrid = null) { targetSrid ??= _targetSRID; try { //If SRID is not set, PARAMETER["central_meridian", PARAMETER["false_easting", PARAMETER["false_northing", PARAMETER["latitude_of_origin", PARAMETER["scale_factor", point b, point2); // assert result.Should().Be(expected); } }, PRIMEM["Greenwich", PROJECTION["Transverse_Mercator"], SPHEROID["GRS 1980", string> { // Coordinate systems: [4326] = GeographicCoordinateSystem.WGS84.WKT, targetSrid); var result = geometry.Copy(); result.Apply(new MathTransformFilter(transformation.MathTransform));, TOWGS84[0, UNIT["Degree", UNIT["metre", we need to project to an appropriate /// coordinate system. If no SRID is provided 25832, which covers Denmark is used. /// If the provided Points have no SRID, y1) { SRID = 4326 }; Point point2 = new Point(x2, y2) { SRID = 4326 }; //CoordinateSystemFactory csFact = new CoordinateSystemFactory(); // act var result = Geometry