geo_fence_utils 1.0.0
geo_fence_utils: ^1.0.0 copied to clipboard
A production-ready Dart package for geofence calculations. Features accurate distance calculation using Haversine formula, circle and polygon geofence detection, batch operations, and comprehensive testing.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.0 - 2026-03-03 #
Added #
- Initial release of geo_fence_utils package
GeoPointmodel with latitude/longitude validationGeoCirclemodel with area and circumference calculationsGeoPolygonmodel with vertex count, centroid, and convexity detectionGeoDistanceServicefor distance calculations using Haversine formulaGeoCircleServicefor circle-based geofence detectionGeoPolygonServicefor polygon-based geofence detection using Ray Casting- Custom exception classes:
GeoExceptionbase exceptionInvalidRadiusExceptionfor invalid radius valuesInvalidPolygonExceptionfor invalid polygon structuresInvalidCoordinateExceptionfor invalid coordinatesGeoCalculationExceptionfor calculation failures
Features #
Distance Calculations
- Great-circle distance calculation using Haversine formula
- Batch distance calculations
- Find closest/farthest points
- Sort points by distance
- Filter points by radius
- Check if points are within distance threshold
Circle Geofence
- Point-in-circle detection
- Point-on-boundary detection with configurable tolerance
- Distance to boundary calculation (positive=outside, negative=inside)
- Batch operations: filter inside/outside, count
- Percentage calculation for point sets
- Circle overlap detection
- Circle containment check
Polygon Geofence
- Point-in-polygon detection using Ray Casting algorithm
- Point-on-boundary detection
- Polygon validation
- Convexity detection
- Batch operations: filter inside/outside, count
- Area calculation
- Perimeter calculation
- Bounding box calculation
- Optimized containment check using bounding box
Utility Functions
- Degree/radian conversions
- Bearing calculations
- Destination point calculation
- Midpoint calculation
- Planar distance approximation
Testing #
- Comprehensive test suite with 187 tests
- 96.044% code coverage (437/455 lines)
- Unit tests for all models and services
- Integration tests for real-world scenarios
- Edge case tests (poles, antipodal points, date line)
Documentation #
- Comprehensive README with examples
- API reference for all public methods
- Performance characteristics
- Accuracy specifications
- Use case examples