calculate polygon area

Mateusz Loskot mateusz at LOSKOT.NET
Thu Jul 20 09:20:22 EDT 2006


Ed McNierney wrote:
> Mateusz -
> 
> I don't mind the Earth being spherical as much as I object to the 
> concept of a "square degree".


Agreed.

> Since a "degree" is an angular measurement, not a linear one, the
> "square degree" mentioned in the code appears to refer to a patch on
> the surface of the sphere defined by two perpendicular one-degree
> angles with their vertices at the CENTER of the sphere.  In other
> words, for a given radius, one "square degree" is indeed a constant
> area.  And a useful concept for game programmers (I used to be one).

Yes, that's my consideration too. If we don't need very accurate
solution we can model the Earth as a sphere with constant well-defined
radius (e.g. mean radious of some ellipsoid).

Then we should get correct results, but as accurate as our model is
accurate.

> This is very confusingly similar to but different from the concept of
>  degrees of latitude and longitude, since a degree of longitude is a 
> one-degree angle with its vertex on a line between the poles, and NOT
> at the center of the Earth.

Yes.

> It appears that the code given (it's hard to tell, given the almost 
> complete absence of comments) takes "latitude" and "longitude" 
> coordinates as inputs, and then finds the angles of the triangles
> inside the defined polygon and calculates the area of those triangles
> using standard spherical geometry.


I think the input coordinates in this function are called lat/lon
to make it simplier to imagine the idea. But users should not assume the
results will be adequate to the Earth model in accuracy.

> If that's the case, then it is possible that the magic "square mi per
>  spherical degree" is the appropriate conversion factor for a roughly
>  spherical Earth, but I can't verify it since the code makes no
> effort to explain where that constant comes from.

The only way to verify is to run some tests.
I have used this procedure with small changes in one of my application
and it gave quite reasonable results, but not accurate in GIS terms :-)

> So it may indeed be possible that this code might produce rough and
> not terribly accurate results.

Yes.


Ed, thanks for nice talk with your interesting explanations.

Best regards
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the mapserver-users mailing list