Class Extensions
Extension methods for the local geo objects.
Inheritance
Inherited Members
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public static class Extensions
Methods
BoundingBox(Polygon, out Single, out Single, out Single, out Single)
Calculates a bounding box for the polygon. TODO: if this is needed a lot, we should cache it in the polygon, see https://github.com/itinero/routing/issues/138
Declaration
public static void BoundingBox(this Polygon polygon, out float north, out float east, out float south, out float west)
Parameters
|
Polygon
polygon
|
|
System.Single
north
|
|
System.Single
east
|
|
System.Single
south
|
|
System.Single
west
|
BoundingBox(List<Coordinate>, out Single, out Single, out Single, out Single)
Calculates a bounding box for the ring.
Declaration
public static void BoundingBox(this List<Coordinate> exteriorRing, out float north, out float east, out float south, out float west)
Parameters
|
List<Coordinate>
exteriorRing
|
|
System.Single
north
|
|
System.Single
east
|
|
System.Single
south
|
|
System.Single
west
|
ConvexHull(IEnumerable<Coordinate>)
Calculates the convex hull around the given points.
Declaration
public static Polygon ConvexHull(this IEnumerable<Coordinate> points)
Parameters
|
IEnumerable<Coordinate>
points
The points. |
Returns
|
Polygon
A convex hull ring around the given points. |
Flip(ref Single)
If the longitude is smaller then 0, add 360. Usefull when coordinates are near the antemeridian
Declaration
public static void Flip(ref float longitude)
Parameters
|
System.Single
longitude
The paramater that is flipped |
Intersect(Polygon, Single, Single, Single, Single)
Returns intersection points with the given polygon.
Declaration
public static IEnumerable<Coordinate> Intersect(this Polygon polygon, float latitude1, float longitude1, float latitude2, float longitude2)
Parameters
|
Polygon
polygon
The polygon |
|
System.Single
latitude1
|
|
System.Single
longitude1
|
|
System.Single
latitude2
|
|
System.Single
longitude2
|
Returns
|
IEnumerable<Coordinate>
|
LocationAfterDistance(Coordinate, Coordinate, Single)
Returns the location between the two coordinates at the given offset distance in meter.
Declaration
public static Coordinate LocationAfterDistance(Coordinate coordinate1, Coordinate coordinate2, float offset)
Parameters
|
Coordinate
coordinate1
The first coordinate. |
|
Coordinate
coordinate2
The second coordinate. |
|
System.Single
offset
The offset in meter starting at coordinate1. |
Returns
|
Coordinate
|
LocationAfterDistance(Coordinate, Coordinate, Single, Single)
Returns the location between the two coordinates at the given offset distance in meter.
Declaration
public static Coordinate LocationAfterDistance(Coordinate coordinate1, Coordinate coordinate2, float distanceBetween, float offset)
Parameters
|
Coordinate
coordinate1
The first coordinate. |
|
Coordinate
coordinate2
The second coordinate. |
|
System.Single
distanceBetween
The distance between the two, when we already calculated it before. |
|
System.Single
offset
The offset in meter starting at coordinate1. |
Returns
|
Coordinate
|
LocationAfterDistance(Line, Single, Boolean)
Returns the location along the line at the given offset distance in meter.
Declaration
public static Coordinate LocationAfterDistance(this Line line, float offset, bool forward = true)
Parameters
|
Line
line
The line. |
|
System.Single
offset
The offset in meter. |
|
System.Boolean
forward
When true the offset starts at the first location, otherwise the second.. |
Returns
|
Coordinate
|
PointIn(Polygon, Coordinate)
Returns true if the given point lies within the polygon.
Note that polygons spanning a pole, without a point at the pole itself, will fail to detect points within the polygon; (e.g. Polygon=[(lat=80°, 0), (80, 90), (80, 180)] will not detect the point (85, 90))
Declaration
public static bool PointIn(this Polygon poly, Coordinate point)
Parameters
|
Polygon
poly
|
|
Coordinate
point
|
Returns
|
System.Boolean
|
PointIn(List<Coordinate>, Coordinate)
Returns true if the given point lies within the ring.
Declaration
public static bool PointIn(List<Coordinate> ring, Coordinate point)
Parameters
|
List<Coordinate>
ring
|
|
Coordinate
point
|
Returns
|
System.Boolean
|
Simplify(Coordinate[], Single)
Simplify the specified points using epsilon.
Declaration
public static Coordinate[] Simplify(this Coordinate[] points, float epsilonInMeter)
Parameters
|
Coordinate[]
points
Points. |
|
System.Single
epsilonInMeter
Epsilon. |
Returns
|
Coordinate[]
|
Simplify(List<Coordinate>, Single)
Simplifies the specified points using episilon.
Declaration
public static List<Coordinate> Simplify(this List<Coordinate> shape, float epsilonInMeter = 0.1F)
Parameters
|
List<Coordinate>
shape
|
|
System.Single
epsilonInMeter
|
Returns
|
List<Coordinate>
|
SimplifyBetween(Coordinate[], Single, Int32, Int32)
Simplify the specified points using epsilon.
Declaration
public static Coordinate[] SimplifyBetween(this Coordinate[] points, float epsilonInMeter, int first, int last)
Parameters
|
Coordinate[]
points
Points. |
|
System.Single
epsilonInMeter
Epsilon. |
|
System.Int32
first
First. |
|
System.Int32
last
Last. |
Returns
|
Coordinate[]
|
SimplifyBetween(List<Coordinate>, Single, Int32, Int32)
Simplify the specified points using epsilon.
Declaration
public static List<Coordinate> SimplifyBetween(this List<Coordinate> points, float epsilonInMeter, int first, int last)
Parameters
|
List<Coordinate>
points
Points. |
|
System.Single
epsilonInMeter
Epsilon. |
|
System.Int32
first
First. |
|
System.Int32
last
Last. |
Returns
|
List<Coordinate>
|
SurfaceArea(Polygon)
Calculates the area of the polygon
Declaration
public static float SurfaceArea(this Polygon poly)
Parameters
|
Polygon
poly
|
Returns
|
System.Single
|
ToLonLatArray(List<Coordinate>)
Converts the coordinates to a double double array.
Declaration
public static double[][] ToLonLatArray(this List<Coordinate> coordinates)
Parameters
|
List<Coordinate>
coordinates
|
Returns
|
System.Double[][]
|