Table of Contents

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 Coordinate

The coordinate to clone.

Coordinate(double, double)

Initializes a new instance of the Coordinate class.

public Coordinate(double x, double y)

Parameters

x double

The x.

y double

The y.

Properties

X

Gets or sets specify x for the longitude.

public double X { get; set; }

Property Value

double

float

Y

Gets or sets specify y for the latitude.

public double Y { get; set; }

Property Value

double

float

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

point PointF

The PointF.

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

x double

The x.

y double

The y.

bearing int

The bearing.

distance double

The distance.

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 double

The fist x coordinate (longitude).

y1 double

The fist y coordinate (latitude).

x2 double

The second x coordinate (longitude).

y2 double

The 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 ISimpleCoordinate

The 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 double

The origin's x-coordinate.

y double

The origin's y-coordinate.

simplePolygon IList<ISimpleCoordinate>

The ISimpleCoordinate list represents the polygon.

Returns

double

double

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The 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 ISimpleCoordinate

The origin coordinates.

to ISimpleCoordinate

The 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

IList<ISimpleCoordinate>

List<T>

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

ISimpleCoordinate

ISimpleCoordinate

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 double

The x-coordinate being tested for intersection.

y double

The 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

bool

bool

IsValidLatitude(double)

Checks if latitude value is within a valid range

public static bool IsValidLatitude(double latitude)

Parameters

latitude double

Latitude 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 double

Longitude 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

left double

The left.

top double

The top.

right double

The right.

bottom double

The bottom.

Returns

IList<ISimpleCoordinate>

ISimpleCoordinate

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()

Returns

string

A string that represents this instance.