2

I get the multypoligon from webservice and I try to calculate area for that poligon with the following code:

var poly = new OpenLayers.Geometry.MultiPolygon(poligon);
var area = geom.getArea();

But that returns me area in square degrees, our projection is EPSG:3243 I was try to use function

OpenLayers.Layer.SphericalMercator.forwardMercator

But that didn't help me alot, is there any other solution or some other hint?

Cheers!

vaske
  • 9,332
  • 11
  • 50
  • 69
  • There is a solution to use other function getGeodesicArea() and than it will looks like this var area = (geom.getGeodesicArea()/1000000) – vaske May 13 '11 at 09:01

1 Answers1

0

You should use the GeodesicArea() function and feed you projection to prevent defaul WGS84:

http://dev.openlayers.org/docs/files/OpenLayers/Geometry/Polygon-js.html#OpenLayers.Geometry.Polygon.getGeodesicArea

getGeodesicArea: function( projection )

something like this:

var projection = new OpenLayers.Projection("EPSG:3243");
var poly = new OpenLayers.Geometry.MultiPolygon(poligon);
var area = poly.getGeodesicArea( projection );
Jeroen
  • 1,638
  • 3
  • 23
  • 48