[OpenLayers-Users] Determining polygon area? Trying to see through the confusion.

Bill Thoen bthoen at gisnet.com
Fri Oct 17 13:25:07 EDT 2008


plen wrote:
> I see that there is a feature.geometry.getArea() function.  This returns
> some value which I am unsure as to its meaning (square degrees?).  I have
> seen previous posts that sort of get into determining polygon areas but
> nothing seems clear.  Maybe this is a bigger type issue than can be handled
> by the OL API, not sure.  I am hoping that someone could answer (or lead to
> an answer) any of the following:
>
> 1) What unit of measurement is returned by the getArea() function?
>
> 2) How to convert that to something like square miles, meters, kilometers,
> etc.
>
> 3) Determining the area for regular polygons vs irrlegular polygons.

It looks like it returns an area in terms of the units of your 
coordinate system. If you are using decimal degrees, then the result is 
essentially meaningless, i.e 'square degrees'.  To get a reasonable 
"flat land" area use coordinate units in meters or feet and then apply 
the appropriate conversion factor to get square miles, hectares, etc. 
The method does appear to accommodate irregular polygons (ones with 
holes in them) by subtracting the area of the holes from the area of the 
outer ring.

If you're up to the coding, there's a description of Girad's Algorithm 
for calculating the surface area of a spherical triangle at 
http://math.rice.edu/~pcmi/sphere/ and that can be extended to determine 
the area of a polygon on a spherical surface using decimal degrees. I 
think this would be a more appropriate method for calculating areas on 
the earth's surface.




More information about the Users mailing list