You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<Description>CoordinateSharp is a high powered, lightweight .NET library that can convert geographical coordinates, perform distance logic, and calculate location based sun, moon, and magnetic information with minimal code.</Description>
60
-
<PackageReleaseNotes>-Adds Day and Night TimeSpan properties to the CelestialInfo class for easier calculation of total day and night hours for a date at a specified location.</PackageReleaseNotes>
60
+
<PackageReleaseNotes>-Adds the ability to densify polylines to mitigate geofence spherical distortions over long distances.</PackageReleaseNotes>
@@ -42,17 +42,21 @@ or shipping CoordinateSharp with a closed source product.
42
42
43
43
Please visit http://coordinatesharp.com/licensing or contact Signature Group, LLC to purchase a commercial license, or for any questions regarding the AGPL 3.0 license requirements or free use license: sales@signatgroup.com.
44
44
*/
45
+
46
+
// Ignore Spelling: Densify
47
+
45
48
usingSystem.Collections.Generic;
46
49
usingSystem;
50
+
usingSystem.Linq;
47
51
48
52
namespaceCoordinateSharp
49
-
{
53
+
{
50
54
/// <summary>
51
55
/// The GeoFence class is used to help check if points/coordinates are inside or near a specified polygon/polyline,
@@ -136,7 +140,8 @@ private Coordinate ClosestPointOnSegment(Point a, Point b, Coordinate p, DateTim
136
140
/// </summary>
137
141
/// <param name="point">Point to test</param>
138
142
/// <remarks>
139
-
/// Points sitting on the edge of a polygon may return true or false.
143
+
/// 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.
144
+
/// Points sitting on the edge of a polygon may return true or false.
140
145
/// </remarks>
141
146
/// <returns>bool</returns>
142
147
/// <example>
@@ -189,6 +194,9 @@ public bool IsPointInPolygon(Coordinate point)
189
194
/// </summary>
190
195
/// <param name="point">Point to test</param>
191
196
/// <param name="range">Range in meters</param>
197
+
/// <remarks>
198
+
/// 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.
199
+
/// </remarks>
192
200
/// <returns>bool</returns>
193
201
/// <example>
194
202
/// The following example shows how to determine if a coordinate is within 1000 meters of
@@ -223,7 +231,7 @@ public bool IsPointInRangeOfLine(Coordinate point, double range)
@@ -232,6 +240,9 @@ public bool IsPointInRangeOfLine(Coordinate point, double range)
232
240
/// </summary>
233
241
/// <param name="point">Point to test</param>
234
242
/// <param name="range">Range is a distance object</param>
243
+
/// <remarks>
244
+
/// 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.
245
+
/// </remarks>
235
246
/// <returns>bool</returns>
236
247
/// <example>
237
248
/// The following example shows how to determine if a coordinate is within 1 km of
@@ -261,12 +272,13 @@ public bool IsPointInRangeOfLine(Coordinate point, Distance range)
261
272
returnfalse;
262
273
263
274
returnIsPointInRangeOfLine(point,range.Meters);
264
-
}
265
-
275
+
}
276
+
266
277
/// <summary>
267
278
/// Gets distance from nearest polyline in shape
268
-
/// </summary>
279
+
/// </summary>
269
280
/// <param name="point">Coordinate</param>
281
+
/// <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.</remarks>
/// Densifies the polygon by adding additional points along each edge at specified intervals using ellipsoidal (Vincenty) logic.
308
+
/// </summary>
309
+
/// <param name="distance">The distance between points along the polygon's edges. This distance determines how frequently new points are inserted into the polygon</param>
310
+
/// <remarks>
311
+
/// This method is particularly useful for large polygons where the curvature of the Earth can cause
312
+
/// significant distortion in geographic calculations. By adding more points at regular intervals,
313
+
/// the polygon better conforms to the curved surface of the Earth, reducing errors in area calculations,
314
+
/// perimeter calculations, and point-in-polygon tests.
315
+
///
316
+
/// The function automatically calculates intermediate points based on the great-circle distance between
317
+
/// existing vertices, ensuring that the new points adhere to the true geographic shape of the polygon.
318
+
/// This is essential for maintaining geographic integrity when performing spatial operations or visualizations.
319
+
///
320
+
/// Note: The densification process increases the number of vertices in the polygon, which may impact performance
321
+
/// and memory usage in spatial computations and data storage. Optimal use of this function depends on the required
322
+
/// precision and the geographic extent of the application.
323
+
/// </remarks>
324
+
/// <example>
325
+
/// Here is how you might use this function to densify a polygon representing a large geographic area:
326
+
/// <code>
327
+
/// //Create a four point GeoFence around Utah
328
+
/// List<GeoFence.Point> points = new List<GeoFence.Point>();
/// //The gf.Points list now contains additional points at intervals of approximately 10 kilometers.
340
+
/// </code>
341
+
/// </example>
342
+
publicvoidDensify(Distancedistance)
343
+
{
344
+
Densify(distance,Shape.Ellipsoid);
345
+
}
346
+
347
+
/// <summary>
348
+
/// Densifies the polygon by adding additional points along each edge at specified intervals.
349
+
/// </summary>
350
+
/// <param name="distance">The distance between points along the polygon's edges. This distance determines how frequently new points are inserted into the polygon</param>
351
+
/// <param name="shape">Specify earth shape. Sphere is more efficient, but less precise than ellipsoid.</param>
352
+
/// <remarks>
353
+
/// This method is particularly useful for large polygons where the curvature of the Earth can cause
354
+
/// significant distortion in geographic calculations. By adding more points at regular intervals,
355
+
/// the polygon better conforms to the curved surface of the Earth, reducing errors in area calculations,
356
+
/// perimeter calculations, and point-in-polygon tests.
357
+
///
358
+
/// The function automatically calculates intermediate points based on the great-circle distance between
359
+
/// existing vertices, ensuring that the new points adhere to the true geographic shape of the polygon.
360
+
/// This is essential for maintaining geographic integrity when performing spatial operations or visualizations.
361
+
///
362
+
/// Note: The densification process increases the number of vertices in the polygon, which may impact performance
363
+
/// and memory usage in spatial computations and data storage. Optimal use of this function depends on the required
364
+
/// precision and the geographic extent of the application.
365
+
/// </remarks>
366
+
/// <example>
367
+
/// Here is how you might use this function to densify a polygon representing a large geographic area:
368
+
/// <code>
369
+
/// //Create a four point GeoFence around Utah
370
+
/// List<GeoFence.Point> points = new List<GeoFence.Point>();
0 commit comments