Distance between two arbitrary WGS84 geometries

163 views Asked by At

I have a .NET Core 3.1 (soon to be .NET 5) app where I use NetTopologySuite to work with spatial data. The task at hand is to find distance between a pair of arbitrary NTS Geometries (let's say a Point and MultiLineString). Both are in WGS84. I need this distance to be in meters, not degrees. Is it possible to do? Note, that the solution has to be quite generic, because I cannot guarantee that both geometries lie within the same UTM zone, for example.

PS. I'm aware of WebMercator & World Mercator projections. The problem is that when I reproject geographic coordinates to those and calculate distance, the error is huge.

PSS. In the past, I used SqlGeography types from MS SQL Server's DLLs to perform the calculation. Unfortunately, they are not [yet?] available for .NET Core (.NET 5).

0

There are 0 answers