| | 1 | | using NetTopologySuite.Geometries; |
| | 2 | |
|
| | 3 | | namespace Itinero.Geo; |
| | 4 | |
|
| | 5 | | /// <summary> |
| | 6 | | /// Extension methods related to coordinates. |
| | 7 | | /// </summary> |
| | 8 | | public static class CoordinateExtensions |
| | 9 | | { |
| | 10 | | /// <summary> |
| | 11 | | /// Converts the coordinate to an Itinero coordinate tuple. |
| | 12 | | /// </summary> |
| | 13 | | /// <param name="coordinate">The coordinate.</param> |
| | 14 | | /// <returns>A coordinate tuple.</returns> |
| | 15 | | public static (double longitude, double latitude, float? e) ToCoordinateTuple(this Coordinate coordinate) |
| 0 | 16 | | { |
| 0 | 17 | | return (coordinate.X, coordinate.Y, null); |
| 0 | 18 | | } |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// Returns an estimate of the distance between the two given coordinates. |
| | 22 | | /// </summary> |
| | 23 | | /// <param name="coordinate">The first coordinate.</param> |
| | 24 | | /// <param name="other">The second coordinate.</param> |
| | 25 | | /// <remarks>Accuracy decreases with distance.</remarks> |
| | 26 | | public static double DistanceEstimateInMeter(this Coordinate coordinate, Coordinate other) |
| 0 | 27 | | { |
| 0 | 28 | | return coordinate.ToCoordinateTuple().DistanceEstimateInMeter(other.ToCoordinateTuple()); |
| 0 | 29 | | } |
| | 30 | | } |