Click or drag to resize

GeoFenceIsPointInRangeOfLine Method (Coordinate, Distance)

Determine if the coordinate is next the given range of the polyline.

Namespace:  CoordinateSharp
Assembly:  CoordinateSharp (in CoordinateSharp.dll) Version: 2.12.1.1
Syntax
C#
public bool IsPointInRangeOfLine(
	Coordinate point,
	Distance range
)

Parameters

point
Type: CoordinateSharpCoordinate
Point to test
range
Type: CoordinateSharpDistance
Range is a distance object

Return Value

Type: Boolean
bool
Examples
The following example shows how to determine if a coordinate is within 1 km of the edge of the specified polygon.
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);

Distance d = new Distance(1, DistanceType.Kilometers);
Console.WriteLine(gf.IsPointInRangeOfLine(c, d)); //False (coordinate is not within 1 km of the edge of the polygon)
See Also