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
coordinate
CoordinateThe 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
points
IList<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
x1
doubleThe fist x coordinate (longitude).
y1
doubleThe fist y coordinate (latitude).
x2
doubleThe second x coordinate (longitude).
y2
doubleThe 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
coordinate
ISimpleCoordinateThe 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
x
doubleThe origin's x-coordinate.
y
doubleThe origin's y-coordinate.
simplePolygon
IList<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
obj
objectThe 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
from
ISimpleCoordinateThe origin coordinates.
to
ISimpleCoordinateThe 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
features
IList<ISimpleCoordinate>The features.
Returns
GetCentroid(IList<ISimpleCoordinate>?)
Get the centroid of collection of ISimpleCoordinate(s).
public static ISimpleCoordinate? GetCentroid(IList<ISimpleCoordinate>? coordinates)
Parameters
coordinates
IList<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
x
doubleThe x-coordinate being tested for intersection.
y
doubleThe y-coordinate being tested for intersection.
simplePolygon
IList<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
feature
IList<ISimpleCoordinate>The feature.
Returns
IsValidLatitude(double)
Checks if latitude value is within a valid range
public static bool IsValidLatitude(double latitude)
Parameters
latitude
doubleLatitude 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
longitude
doubleLongitude 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()