Class GeoPositionExtension
A static helper and extension class with utility functions for geo-referenced positions of Position
Inheritance
System.Object
GeoPositionExtension
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Mars.Interfaces.Environments
Assembly: Mars.Interfaces.dll
Syntax
public static class GeoPositionExtension
Methods
| Improve this Doc View SourceDistanceInKmTo(Position, Position)
Calculates the distance between two Positions in kilometers
by applying the great circle distance for geospatial-reference positions.
Declaration
public static double DistanceInKmTo(this Position position, Position target)
Parameters
| Type | Name | Description |
|---|---|---|
| Position | position | The source geospatial referenced position. |
| Position | target | The target geospatial referenced position. |
Returns
| Type | Description |
|---|---|
| System.Double | The distance between the points in kilometers |
DistanceInKmTo(in Double, in Double, in Double, in Double)
Computes the great circle distance between this Mars.Interfaces.Environment.Position instance and the location
argument.
Declaration
public static double DistanceInKmTo(in double p1Lon, in double p1Lat, in double p2Lon, in double p2Lat)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | p1Lon | x or longitude coordinate of the first point. |
| System.Double | p1Lat | y or latitude coordinate of the first point. |
| System.Double | p2Lon | x or longitude coordinate of the first point. |
| System.Double | p2Lat | y or latitude coordinate of the first point. |
Returns
| Type | Description |
|---|---|
| System.Double | the distance, measured in the same unit as the point argument. |
DistanceInMTo(Position, Position)
Calculates the distance between two Positions in meters
by applying the great circle distance for geospatial-reference positions.
Declaration
public static double DistanceInMTo(this Position position, Position target)
Parameters
| Type | Name | Description |
|---|---|---|
| Position | position | The source geospatial referenced position. |
| Position | target | The target geospatial referenced position. |
Returns
| Type | Description |
|---|---|
| System.Double | The distance between the points in meters |
DistanceInMTo(Position, Double, Double)
Calculates the distance between two Positions in meters
by applying the great circle distance for geospatial-reference positions.
Declaration
public static double DistanceInMTo(this Position position, double targetX, double targetY)
Parameters
| Type | Name | Description |
|---|---|---|
| Position | position | The source geospatial referenced position. |
| System.Double | targetX | The x-component of the target. |
| System.Double | targetY | The y-component of the target. |
Returns
| Type | Description |
|---|---|
| System.Double | The distance between the points in meters |
IsValidLatitude(Double)
Checks for valid latitude value within range -90 to +90
Declaration
public static bool IsValidLatitude(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | value | The double value |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the value is correct |
IsValidLongitude(Double)
Checks for valid longitude value within range -180 to +180
Declaration
public static bool IsValidLongitude(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | value | The double value |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if the value is correct |