geoarea

0.0.1 • Public • Published

geo-area-calculator

Вычисление площади полигона в координатах WGS'84. Порт Python-алгоритма на PHP и JS. Статья источник: http://gis-lab.info/qa/polygon-area-sphere-ellipsoid.html

Установка

В корне модуля:

.../geo-area-calculator$ composer install

Если необходимы js-тесты:

.../geo-area-calculator$ npm install

Тесты

PHP

.../geo-area-calculator$ phpunit

JavaScript

.../geo-area-calculator$ npm test

Примеры

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)

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i geoarea

    Weekly Downloads

    3

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • siddthartha