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

Pierre GIRAUD bluecarto at gmail.com
Sat Oct 18 10:30:58 EDT 2008


I think you're right, it's only for distance.
However, the example shows a conversion to a different measurement
unit even for areas.

Pierre

On Sat, Oct 18, 2008 at 2:44 PM, Christopher Schmidt
<crschmidt at metacarta.com> wrote:
> On Sat, Oct 18, 2008 at 10:49:57AM +0200, Pierre GIRAUD wrote:
>> I think that there's something already done in OpenLayers, at least in
>> the examples.
>> Have a look at the measure example [1], there's kind of a conversion
>> thing using distVincenty.
>
> distVincenty is for lines, not area.
>
>> Hope this helps,
>> Pierre
>>
>> [1] http://www.openlayers.org/dev/examples/measure.html
>>
>> On Fri, Oct 17, 2008 at 7:25 PM, Bill Thoen <bthoen at gisnet.com> wrote:
>> > 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.
>> >
>> > _______________________________________________
>> > Users mailing list
>> > Users at openlayers.org
>> > http://openlayers.org/mailman/listinfo/users
>> >
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>
> --
> Christopher Schmidt
> MetaCarta
>



More information about the Users mailing list