util.calculateArea: plugin for calculating geodesic features area.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 1520868 Aug 21, 2018
Failed to load latest commit information.
build Unminified dev build (#4) Aug 21, 2018
src fixes after review Jun 26, 2017
test fixes after review Jun 26, 2017
.gitignore Unminified dev build (#4) Aug 21, 2018
Gruntfile.js First commit Jun 26, 2017
LICENSE.md First commit Jun 26, 2017
README.md util.caclulateArea -> util.calculateArea Jul 4, 2017
package.json fixes after review Jun 26, 2017
test.conf.js First commit Jun 26, 2017


Yandex Maps API area calculation plugin.

util.calculateArea module allows to calculate the area of polygons, rectangles and circles. Note that plugin works only with geodesic geometries.


  1. Put module source code (util.calculateArea.min.js) on your CDN.

  2. Load both Yandex Maps JS API 2.1 and module source code by adding following code into <head> section of your page

    <script src="http://api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script>
    <!-- Change my.cdn.tld to your CDN host name -->
    <script src="http://my.cdn.tld/util.calculateArea.min.js" type="text/javascript"></script>
  3. Wait for both API and module loaded

    ymaps.ready(['util.calculateArea']).then(function () {
        var myPolygon = new ymaps.Polygon(someCoordinates);
        // You can calculate area of any type of ymaps.GeoObject.
        var area = ymaps.util.calculateArea(myPolygon);
        // Or you can calculate area of GeoJson feature.
        var areaFromJson = ymaps.util.calculateArea({
                type: 'Feature',
                geometry: {
                    type: 'Rectangle',
                    coordinates: someRectangleCoordinates

Note: module definition uses standard Yandex Maps API namespace 'ymaps'. If you are using custom namespace, you need to fork and rebuild module for your needs.


geoObject descibed using one of following formats:

  • ymaps.GeoObject
  • ymaps.Polygon
  • ymaps.Rectangle
  • ymaps.Circle
  • GeoJson Polygon
  • GeoJson Rectangle
  • GeoJson Circle

Returns geoObject area in square meters.

For contributors

If you want to make a pull-request, run tests and check code style first.

npm install
npm run-script lint
npm test