Class Coordinate
- Namespace
- Geotab.Checkmate.ObjectModel
- Assembly
- Geotab.Checkmate.ObjectModel.dll
A coordinate on the earth's surface. "x" is longitude and "y" is latitude.
public class Coordinate : ISimpleCoordinate
- Inheritance
-
Coordinate
- Implements
- Derived
- Inherited Members
Constructors
Coordinate()
Initializes a new instance of the Coordinate class.
public Coordinate()
Coordinate(Coordinate)
Initializes a new instance of the Coordinate class.
public Coordinate(Coordinate coordinate)
Parameters
coordinateCoordinateThe coordinate to clone.
Coordinate(double, double)
Initializes a new instance of the Coordinate class.
public Coordinate(double x, double y)
Parameters
Properties
X
Gets or sets specify x for the longitude.
public double X { get; set; }
Property Value
Y
Gets or sets specify y for the latitude.
public double Y { get; set; }
Property Value
Methods
CalculatePolygonArea(IList<ISimpleCoordinate>?)
Calculate area of an n-polygon in square kilometres.
public static double CalculatePolygonArea(IList<ISimpleCoordinate>? points)
Parameters
pointsIList<ISimpleCoordinate>The n+1 coordinates of the n-polygon.
Returns
- double
a double
Create(PointF)
instantiates a new instance of Coordinate from PointF/>
public static Coordinate Create(PointF point)
Parameters
Returns
- Coordinate
New instance of Coordinate
DestinationCoordinateGivenDistanceBearingAndStartingPoint(double, double, int, double)
Calculates a new Coordinate based off of an origin coordinate, bearing in degrees, and linear distance.
public static Coordinate DestinationCoordinateGivenDistanceBearingAndStartingPoint(double x, double y, int bearing, double distance)
Parameters
Returns
- Coordinate
New instance of Coordinate
DistanceBetween(double, double, double, double)
Returns the distance between this point and the supplied point.
public static double DistanceBetween(double x1, double y1, double x2, double y2)
Parameters
x1doubleThe fist x coordinate (longitude).
y1doubleThe fist y coordinate (latitude).
x2doubleThe second x coordinate (longitude).
y2doubleThe second y coordinate (latitude).
Returns
- double
The distance.
DistanceFrom(ISimpleCoordinate)
Returns the distance between this point and the supplied point in meters.
public double DistanceFrom(ISimpleCoordinate coordinate)
Parameters
coordinateISimpleCoordinateThe ISimpleCoordinate being checked for distance.
Returns
- double
The distance.
DistanceFromPoly(double, double, IList<ISimpleCoordinate>)
The distance from the closest polygon's border to the point.
public static double DistanceFromPoly(double x, double y, IList<ISimpleCoordinate> simplePolygon)
Parameters
xdoubleThe origin's x-coordinate.
ydoubleThe origin's y-coordinate.
simplePolygonIList<ISimpleCoordinate>The ISimpleCoordinate list represents the polygon.
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
- bool
true if the specified object is equal to the current object; otherwise, false.
GetBearing(ISimpleCoordinate, ISimpleCoordinate)
Calculates a geographical bearing between two points.
public static int GetBearing(ISimpleCoordinate from, ISimpleCoordinate to)
Parameters
fromISimpleCoordinateThe origin coordinates.
toISimpleCoordinateThe destination coordinates.
Returns
- int
The bearing in degrees.
GetCalculatedExtent(IList<ISimpleCoordinate>?)
Recalculate the extent of collection of ISimpleCoordinate.
public static IList<ISimpleCoordinate>? GetCalculatedExtent(IList<ISimpleCoordinate>? features)
Parameters
featuresIList<ISimpleCoordinate>The features.
Returns
GetCentroid(IList<ISimpleCoordinate>?)
Get the centroid of collection of ISimpleCoordinate(s).
public static ISimpleCoordinate? GetCentroid(IList<ISimpleCoordinate>? coordinates)
Parameters
coordinatesIList<ISimpleCoordinate>The coordinates.
Returns
GetHashCode()
Serves as a hash function for a particular type.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
IntersectsWithPoly(double, double, IList<ISimpleCoordinate>?)
Returns whether the polygon intersects with a specific x and y.
public static bool IntersectsWithPoly(double x, double y, IList<ISimpleCoordinate>? simplePolygon)
Parameters
xdoubleThe x-coordinate being tested for intersection.
ydoubleThe y-coordinate being tested for intersection.
simplePolygonIList<ISimpleCoordinate>The ISimpleCoordinate list (the polygon) being tested for intersection.
Returns
- bool
true if the co-ordinate intersects with the polygon.
IsPolygon(IList<ISimpleCoordinate?>)
Get whether this polygon is a properly formed polygon having the end point equal to the first point.
public static bool IsPolygon(IList<ISimpleCoordinate?> feature)
Parameters
featureIList<ISimpleCoordinate>The feature.
Returns
IsValidLatitude(double)
Checks if latitude value is within a valid range
public static bool IsValidLatitude(double latitude)
Parameters
latitudedoubleLatitude value
Returns
- bool
Returns True if latitude value is within a valid range
IsValidLongitude(double)
Checks if longitude value is within a valid range
public static bool IsValidLongitude(double longitude)
Parameters
longitudedoubleLongitude value
Returns
- bool
Returns True if longitude value is within a valid range
RectangleFromLtrb(double, double, double, double)
Gets collection of ISimpleCoordinate(s) representing rectangular shape.
public static IList<ISimpleCoordinate> RectangleFromLtrb(double left, double top, double right, double bottom)
Parameters
Returns
ToLatLonString()
Returns a comma separated latitude longitude string for given Coordinate.
public string ToLatLonString()
Returns
- string
Comma separated Y(lat), X(lon) string.
ToLonLatString()
Returns a comma separated longitude latitude string for given Coordinate.
public string ToLonLatString()
Returns
- string
Comma separated X(lon), Y(lat) string.
ToString()
Returns a string that represents this instance.
public override string ToString()