[OpenLayers-Users] area enclosed by linestring

Jim White jbw2003 at earthlink.net
Sun Jan 15 21:04:24 EST 2012


I looked up some Mercator formula on Wolfram and I think my equation in 
not the correct one. That being said, the data is lat/lon from a third 
party program that was imported into PostGIS and then served by GeoServer.

On 01/15/2012 04:42 PM, Tobias Reinicke wrote:
> Fair enough. I presume you aren't drawing the linestring by hand yes?
> and that there are no obvious rounding errors?
>
> Toby
>
> On 15 January 2012 21:23, Jim White<jbw2003 at earthlink.net>  wrote:
>> I tried that first. It was way off. I think by a factor of cos(lat)**2.
>>
>>
>>
>>
>> On 01/15/2012 03:24 PM, Toby Reinicke wrote:
>>> Do you have the same issue if you just use ring.getArea() function?
>>>
>>> On 15 Jan 2012, at 18:31, Jim White<jbw2003 at earthlink.net>    wrote:
>>>
>>>> Hi,
>>>>
>>>> I use this to calculate the number of acres enclosed by a linestring:
>>>>
>>>> ring = new OpenLayers.Geometry.LinearRing(geometry.getVertices());
>>>> area = ring.getGeodesicArea(new OpenLayers.Projection("EPSG:900913"));
>>>> area = Math.floor(Math.abs(area*0.000247105381));
>>>>
>>>> The calculated area consistently produces results that are 2-3% too
>>>> small. Is this an error in my code or is my data the problem?
>>>>
>>>> Thanks,
>>>> Jim White
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>



More information about the Users mailing list