# surface area of polygon

**URL:** <https://community.cesium.com/t/surface-area-of-polygon/2832>\
**Category:** CesiumJS\
**Created:** [July 22, 2015, 8:08pm UTC](https://community.cesium.com/t/surface-area-of-polygon/2832 "2015-07-22T20:08:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![suparn1904](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@suparn1904](https://community.cesium.com/u/suparn1904)\
**Post date:** [July 22, 2015, 8:08pm UTC](https://community.cesium.com/t/surface-area-of-polygon/2832/1 "2015-07-22T20:08:24Z")

</div>

Hi,

I need to calculate the surface area of Polygon in Cesium in 3D.

Any help is appreciated!  
Thanks.

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [July 22, 2015, 11:33pm UTC](https://community.cesium.com/t/surface-area-of-polygon/2832/2 "2015-07-22T23:33:19Z")

</div>

Hello,

Cesium currently doesn’t have this functionality, but we plan on implementing it in the future.

Meanwhile, take a look at [Turf.js](https://github.com/Turfjs/turf). Their area implementation isn’t 100% accurate, but it give a close approximation.

Best Regards,

-Hannah

---

<div class="post-metadata">

**Author:** ![suparn1904](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@suparn1904](https://community.cesium.com/u/suparn1904)\
**Post date:** [July 23, 2015, 7:21pm UTC](https://community.cesium.com/t/surface-area-of-polygon/2832/3 "2015-07-23T19:21:41Z")

</div>

Thanks Hannah for the help .  
Will look into this.

---

<div class="post-metadata">

**Author:** ![David\_Whipps](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/david_whipps/32/3522_2.png) [@David\_Whipps](https://community.cesium.com/u/David_Whipps)\
**Post date:** [September 7, 2016, 2:11pm UTC](https://community.cesium.com/t/surface-area-of-polygon/2832/4 "2016-09-07T14:11:03Z")

</div>

Hey All,

I just worked on this myself and used the following. (It’s rough, but gives a pretty good approximation.)

// Get the polygon from your “entity”  
var polygon = theEntity.polygon;

var hierarchy = polygon.hierarchy.\_value;

// “indices” here defines an array, elements of which defines the indice of a vector

// defining one corner of a triangle. Add up the areas of those triangles to get  
// an approximate area for the polygon

var indices = Cesium.PolygonPipeline.triangulate(hierarchy.positions, hierarchy.holes);

var area = 0; // In square kilometers

for (var i = 0; i \< indices.length; i += 3) {

var vector1 = hierarchy.positions[indices[i]];

var vector2 = hierarchy.positions[indices[i+1]];

var vector3 = hierarchy.positions[indices[i+2]];

// These vectors define the sides of a parallelogram (double the size of the triangle)

var vectorC = Cesium.Cartesian3.subtract(vector2, vector1, new Cesium.Cartesian3());

var vectorD = Cesium.Cartesian3.subtract(vector3, vector1, new Cesium.Cartesian3());

// Area of parallelogram is the cross product of the vectors defining its sides

var areaVector = Cesium.Cartesian3.cross(vectorC, vectorD, new Cesium.Cartesian3());

// Area of the triangle is just half the area of the parallelogram, add it to the sum.

area += Cesium.Cartesian3.magnitude(areaVector)/2.0;

}

``

Hope that helps.

- Dave

---

<div class="post-metadata">

**Author:** ![Abel\_Gonzalez](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/abel_gonzalez/32/1987_2.png) [@Abel\_Gonzalez](https://community.cesium.com/u/Abel_Gonzalez)\
**Post date:** [October 26, 2018, 6:53am UTC](https://community.cesium.com/t/surface-area-of-polygon/2832/5 "2018-10-26T06:53:32Z")

</div>

Hi Dave!

Thanks for your code, I just tried but I can't make it work. Is that possible for you send a working example?

BR  
Abel
