[OpenLayers-Users] Wrong area calculation

Andreas Hocevar ahocevar at opengeo.org
Wed Feb 17 05:13:35 EST 2010


On 2010-02-17 09:40, Dragan Podvezanec wrote:
> Hi all.
>
> I have one WFS layer from EPSG:31275, which is then reprojected to 900913
> and overlayed on Google layer.
>
> I noticed that polygon areas caculated with feature.geometry.getArea() are
> wrong. Original layer is stored in database, and uses same units (meters),
> so I'm sure about original feature area in DB.
>   

Use feature.geometry.getGeodesicArea() instead.

Regards,
Andreas.


> What is strange is that areas are always 
>
> those from DB * 2
>
> For example: 
>
> Original polygon area from DB: 812m2
> Area calculated by feature.geometry.getArea(): 1624m2
>
> Can someone point me what is wrong here? Is this due to reprojection, or
> something else?
>   


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list