8

i use QGIS with openlayers-plugin and i´ve loaded google satellite as a layer. what i want to do is making a shape-layer (polygon) with the goal to get the area values of the polygons. i´ve activated on-the-fly-transformation and chosen Google Mercator (EPSG:900913) for the project and the shape-layer.

If i compare the values of the measure line tool in qgis with the one in google earth (desktop version) to make a rough estimate, i get two different values. they are same if i activate ellipsoidal on the measure line tool in QGIS. The area calculation takes places with ellipsoidal deactivated, so the area result in the attribute table is wrong. I know that the values of google earth are correct.

Does someone know a way to get an correct area calculation of the polygons?

1
  • I see this problem too
    – Willy
    Commented Oct 31, 2012 at 10:40

2 Answers 2

5

Google Mercator, like any other Mercator is a Conform projection, which means that it keeps the angles, but distort the areas. In this case as you distance yourself from the equator, the bigger is the distortion.

Google Earth area measure tool is probably auto-correcting that problem, but I'm not sure, and thats why you see those differences.

In QGIS, the best way to precisely measure areas is:

  • For big areas, like a continent, use an Equal-area projection:
  • For smaller areas, use a suitable local Coordinate System. Each country has generally a few official Coordinate Reference Systems. Those systems, within the area of interest of the country, are generally good to measure both angles and areas, with little distortions. Bigger countries might have different CRS for different regions.

Setting the right CRS to the QGIS Project, with On-the-Fly-Projection, will allow you to "correctly" measure areas using the google layer as background.

2
  • You should mention to check "Ellipsoid" in the measurement tool. It will convert the result to real metres even if Google projection or latlon is used. Only thing that does not work is $area function in field calculator. This computes with the CRS of the layer, not that of the project.
    – AndreJ
    Commented Nov 27, 2012 at 12:13
  • In the question, Lenni, already told that he was not able to compute areas correctly using the check on the Ellipsoid. IMHO my approach might be more tedious but it will allow the users to understand what he is doing, while it works with all measuring tools. Commented Nov 27, 2012 at 15:05
0

This Openlayers Example is using the different measuring controls

enter image description here

Measure Controls (code)

     measureControls = {
            line: new OpenLayers.Control.Measure(
                OpenLayers.Handler.Path, {
                    persist: true,
                    handlerOptions: {
                        layerOptions: {
                            renderers: renderer,
                            styleMap: styleMap
                        }
                    }
                }
            ),
            polygon: new OpenLayers.Control.Measure(
                OpenLayers.Handler.Polygon, {
                    persist: true,
                    handlerOptions: {
                        layerOptions: {
                            renderers: renderer,
                            styleMap: styleMap
                        }
                    }
                }
            )
        };

        var control;
        for(var key in measureControls) {
            control = measureControls[key];
            control.events.on({
                "measure": handleMeasurements,
                "measurepartial": handleMeasurements
            });
            map.addControl(control);
        }


       function toggleControl(element) {
        for(key in measureControls) {
            var control = measureControls[key];
            if(element.value == key && element.checked) {
                control.activate();
            } else {
                control.deactivate();
            }
        }
    }

    function toggleGeodesic(element) {
        for(key in measureControls) {
            var control = measureControls[key];
            control.geodesic = element.checked;
        }
    }

    function toggleImmediate(element) {
        for(key in measureControls) {
            var control = measureControls[key];
            control.setImmediate(element.checked);
        }
    }

http://openlayers.org/dev/examples/measure.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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