# Polygon area on geoid

**URL:** <https://discourse.julialang.org/t/polygon-area-on-geoid/9107>\
**Category:** Geo\
**Tags:** question, gmt, polygons\
**Created:** [February 16, 2018, 9:30am UTC](https://discourse.julialang.org/t/polygon-area-on-geoid/9107 "2018-02-16T09:30:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mafla](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mafla/32/3461_2.png) [@mafla](https://discourse.julialang.org/u/mafla)\
**Post date:** [February 16, 2018, 9:30am UTC](https://discourse.julialang.org/t/polygon-area-on-geoid/9107/1 "2018-02-16T09:30:39Z")

</div>

Hi all, is it possible to estimate the area of a lat-lon-box with Geodesy.jl? Many thanks!

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [February 16, 2018, 5:20pm UTC](https://discourse.julialang.org/t/polygon-area-on-geoid/9107/2 "2018-02-16T17:20:48Z")

</div>

```julia
using GMT
julia> r = gmt("gmtspatial -Qk -fg", [0 0; 0 1; 1 1; 1 0; 0 0])
1-element Array{GMT.GMTdataset,1}:
 GMT.GMTdataset([0.5 0.50002 12308.3], Any[], "", Any[], "", "")

julia> r[1].data
1×3 Array{Float64,2}:
 0.5 0.50002 12308.3

```

The area is the last figure, that is 12308.3 km^2. Se the man page of the `gmtspatial` GMT program for more details

---

<div class="post-metadata">

**Author:** ![mafla](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mafla/32/3461_2.png) [@mafla](https://discourse.julialang.org/u/mafla)\
**Post date:** [February 16, 2018, 8:38pm UTC](https://discourse.julialang.org/t/polygon-area-on-geoid/9107/3 "2018-02-16T20:38:47Z")

</div>

Thank you very much - but the question was if this was possible using Geodesy.jl. The reason is that I use julia on a remote server where I cannot load the library “libgmt”.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [November 1, 2021, 4:46pm UTC](https://discourse.julialang.org/t/polygon-area-on-geoid/9107/4 "2021-11-01T16:46:28Z")

</div>

@mafla you can convert the coordinates of the polygon to Cartesian coordinates with Geodesy.jl and then use Meshes.jl to compute the area with `area(polygon)`.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [November 1, 2021, 8:25pm UTC](https://discourse.julialang.org/t/polygon-area-on-geoid/9107/5 "2021-11-01T20:25:07Z")

</div>

@juliohm, in order to correctly take into account the curvature of the geoid, do we need to add control points inside the polygon that lie on the geoid, to help Meshes.jl?

Thinking of an extreme case: _the area above the latitude of the Artic Circle that otherwise would be calculated as a flat disk._

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [November 1, 2021, 9:00pm UTC](https://discourse.julialang.org/t/polygon-area-on-geoid/9107/6 "2021-11-01T21:00:30Z")

</div>

Good point @rafael.guerra , probably a good idea 💯

I am planning to take a closer look at curved geometries in Meshes.jl next year 🙏🏽

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [November 1, 2021, 10:42pm UTC](https://discourse.julialang.org/t/polygon-area-on-geoid/9107/7 "2021-11-01T22:42:03Z")

</div>

GMT.jl [geomarea](https://www.generic-mapping-tools.org/GMT.jl/dev/#GMT.Gdal.geomarea-Tuple%7BGMT.Gdal.AbstractGeometry%7D) method calls GDAL and I think it ends up calling the a [geographiclib](https://geographiclib.sourceforge.io/) function for geodetic polygons but I’m not finding the docs sustaining this later claim.
