Converting area from degrees to square kilometres using OpenLayers geometry?

I get a multypolygon from my web service and want to calculate the area of that polygon. I was trying to use this piece of code:

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

But that returns the area in square degrees. The projection is EPSG:3243.
I then tried to use

OpenLayers. Layer. SphericalMercator

But that didn't help me a lot.

Is there any other solution or some other hint?

Try this:

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

var kmArea = area / 1000000;
• I think you need to divide by 1e6 to get square km not multiply by 1000. – Ian Turton May 13 '11 at 14:42
• Not sure, but wouldn't it be divide by 1000 since the function returns square meters? I definitely goofed by multiplying by 1000 but what i meant was divide by 1000. – CaptDragon May 13 '11 at 14:49
• there are 1000m in a Km so 1000*1000 sq m in a sq km – Ian Turton May 13 '11 at 14:54
• +1 Okay i follow you, excuse my math disorder, but then it would be area / 1000000? – CaptDragon May 13 '11 at 15:02
• that's what I said :-) – Ian Turton May 13 '11 at 15:09

as far as I know it is not possible. Some references to it:

http://support.esri.com/en/knowledgebase/techarticles/detail/27851