Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question

Try this:

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

var kmArea = area * 1000;


EDIT: Sorry, don't multiply by 1000 DIVIDE by 1000000.

var kmArea = area / 1000000;
share|improve this answer
I think you need to divide by 1e6 to get square km not multiply by 1000. – iant 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 – iant 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 :-) – iant May 13 '11 at 15:09

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

You will need to transform to meters first.

share|improve this answer
actually there is another function in geometry getGeodesicArea() wich returns aproximated area in square meters! – vaske May 13 '11 at 9:10
@vaske: Is your comment the answer to your question? – underdark May 13 '11 at 9:25
This is OpenLayers not ArcMap. – CaptDragon May 13 '11 at 13:59
I know that, but the question was how to convert square degrees to square meters and I suggested to do it before getting area. – Mykolas Simutis May 13 '11 at 14:24
@underdark yes that's the answer :) – vaske May 16 '11 at 6:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.