Dependencies free QGIS ellipsoidal area calculation reproduced in JavaScript.
also look at the Python implementation
Simply download and include with a script tag, Area
will be registered as a global variable.
<script src="../lib/area.global.js"></script>
<script>
var area = Area.calculateArea([
[51.82, 63.8],
[43.48, 55.62],
[75.38, 59.13],
[51.82, 63.8], // the first and last positions MUST contain identical values
]);
var area = Area.geojsonArea(geojson);
</script>
unpkg
<script src="https://unpkg.com/@nextgis/area"></script>
jsdelivr
<script src="https://cdn.jsdelivr.net/npm/@nextgis/area"></script>
We recommend linking to a specific version number /area@[version]
npm install @nextgis/area
import { calculateArea, geojsonArea } from '@nextgis/area';
const area = geojsonArea(geojson);
const area2 = calculateArea([
[51.82, 63.8],
[43.48, 55.62],
[75.38, 59.13],
[51.82, 63.8], // the first and last positions MUST contain identical values
]);
console.log(area2); // 730215205638.4752
Check out the API Documentation
Implementations and code in other software, languages
Need to fix a bug or add a feature to @nextgis/area
? We provide custom development and support for this software. Contact us to discuss options!