siddthartha / geo-area
Geographical area of given polygon in WGS84
Installs: 33
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/siddthartha/geo-area
Requires
- php: >=5.4.0
- components/qunit: ^1.11
Requires (Dev)
- phpunit/phpunit: ^4
This package is not auto-updated.
Last update: 2025-10-02 00:08:14 UTC
README
Calculation of polygon area in WGS'84 coordinates. Port of the Python algorithm to PHP and JS.
Install
In the project root folder:
.../geo-area-calculator$ composer install
If js tests needed:
.../geo-area-calculator$ npm install
Tests
PHP
.../geo-area-calculator$ phpunit
JavaScript
.../geo-area-calculator$ npm test
Examples
JavaScript
alert( ffGeo.getGeoPolygonArea( [ [ -10.812317, 18 ], [ 10.812317, -18 ], [ 26.565051, 18 ], [ 52.622632, -18 ], [ 52.622632, 54 ], [ 10.812317, 54 ], [ -10.812317, 18 ], ] ) );
PHP
use siddthartha\geo\area\helpers\GeoAreaCalculator; echo GeoAreaCalculator::getArea( [ [ -10.812317, 18 ], [ 10.812317, -18 ], [ 26.565051, 18 ], [ 52.622632, -18 ], [ 52.622632, 54 ], [ 10.812317, 54 ], [ -10.812317, 18 ], ] ); // 33953235824742.51 (sq.meters)