GeoFenceDensify(Distance, Earth_Ellipsoid) Method

Densifies the polygon by adding additional points along each edge at specified intervals using ellipsoidal (Vincenty) logic with a user specified earth shape.

Definition

Namespace: CoordinateSharp
Assembly: CoordinateSharp (in CoordinateSharp.dll) Version: 3.1.1.1
XMLNS for XAML: Not mapped to an xmlns.
C#
public void Densify(
	Distance distance,
	Earth_Ellipsoid ellipsoid
)

Parameters

distance  Distance
The distance between points along the polygon's edges. This distance determines how frequently new points are inserted into the polygon
ellipsoid  Earth_Ellipsoid
Specify earth ellipsoid shape.

Remarks

This method is particularly useful for large polygons where the curvature of the Earth can cause significant distortion in geographic calculations. By adding more points at regular intervals, the polygon better conforms to the curved surface of the Earth, reducing errors in area calculations, perimeter calculations, and point-in-polygon tests. The function automatically calculates intermediate points based on the great-circle distance between existing vertices, ensuring that the new points adhere to the true geographic shape of the polygon. This is essential for maintaining geographic integrity when performing spatial operations or visualizations. Note: The densification process increases the number of vertices in the polygon, which may impact performance and memory usage in spatial computations and data storage. Optimal use of this function depends on the required precision and the geographic extent of the application.

Example

Here is how you might use this function to densify a polygon representing a large geographic area:
C#
//Create a four point GeoFence around Utah
List<GeoFence.Point> points = new List<GeoFence.Point>();
points.Add(new GeoFence.Point(41.003444, -109.045223));
points.Add(new GeoFence.Point(41.003444, -102.041524));
points.Add(new GeoFence.Point(36.993076, -102.041524));
points.Add(new GeoFence.Point(36.993076, -109.045223));
points.Add(new GeoFence.Point(41.003444, -109.045223));

GeoFence gf = new GeoFence(points);

gf.Densify(new Distance(10, DistanceType.Kilometers), Earth_Ellipsoid.Get_Ellipsoid(Earth_Ellipsoid_Spec.GRS67_1967));

//The gf.Points list now contains additional points at intervals of approximately 10 kilometers.

See Also