GeoFenceIsPointInRangeOfLine(Coordinate, Double) Method

Determine if a coordinate is next to the given range (in meters) of the polyline.

Definition

Namespace: CoordinateSharp
Assembly: CoordinateSharp (in CoordinateSharp.dll) Version: 3.1.1.1
XMLNS for XAML: Not mapped to an xmlns.
C#
public bool IsPointInRangeOfLine(
	Coordinate point,
	double range
)

Parameters

point  Coordinate
Point to test
range  Double
Range in meters

Return Value

Boolean
bool

Remarks

This method utilizes 2D ray casting techniques and does not inherently account for the curvature of the Earth. To mitigate the impact of Earth shape distortion on polygons or polylines that span long distances, users should employ densification.

Example

The following example shows how to determine if a coordinate is within 1000 meters of the edge of the specified polygon.
C#
List<GeoFence.Point> points = new List<GeoFence.Point>();

//Points specified manually to create a square in the USA.
//First and last points should be identical if creating a polygon boundary.
points.Add(new GeoFence.Point(31.65, -106.52));
points.Add(new GeoFence.Point(31.65, -84.02));
points.Add(new GeoFence.Point(42.03, -84.02));
points.Add(new GeoFence.Point(42.03, -106.52));
points.Add(new GeoFence.Point(31.65, -106.52));

GeoFence gf = new GeoFence(points);

Coordinate c = new Coordinate(36.67, -101.51);

//Determine if Coordinate is within specific range of shapes line.
Console.WriteLine(gf.IsPointInRangeOfLine(c, 1000)); //False (coordinate is not within 1000 meters of the edge of the polygon)

See Also