endurance / geo
Streaming path geometry and spherical distance calculations
v0.2.0
2026-11-23 20:28 UTC
Requires
- php: ^8.5
- endurance/foundation: ^0.2.0
Requires (Dev)
- phpunit/phpunit: ^12.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-23 20:31:11 UTC
README
Streaming path geometry, ordered via points and horizontal distance for PHP 8.5.
composer require endurance/geo
use Endurance\Foundation\ValueObject\Coordinate; use Endurance\Geo\{PathGeometry, PathLength, PathPoint, PathPosition}; $path = new PathGeometry([ new PathPoint(new PathPosition(0, 0), new Coordinate(0.0, 179.0)), new PathPoint(new PathPosition(0, 1), new Coordinate(0.0, -179.0)), ]); $length = new PathLength(); $length->append($path); $summary = $length->summary();
- Part and point indexes are consecutive and zero-based. Parts preserve gaps; repeated coordinates are valid. Adjacent parts never acquire a connecting edge.
- Geometry is lazy and generator-backed input is single-pass. Consume it fully
for validation. Keep the same
PathLength/PathSequenceacross successive pages; an accepted prefix after failure is not a complete result. ViaPointsdescribes places to visit without asserting a connecting path. Missing elevation stays null; zero and negative elevation remain known values.- Length uses a sphere of radius 6,371,008.8 m and ignores elevation. No edges means unknown length; observed zero-length edges mean a known zero.
License: MPL-2.0.