4

On the website The true size of ..., you can shift the shape of countries to other world regions to see the true size (area) on a distorted map (mercator projection). Dragging Greenland over Africa is a classic example (see screenshot below).

Unfortunately, on the site I can't find any information about the procedure in the background - how it's done.

I'm wondering how the same result can be achieved using QGIS only. What I tried and what works as a workaround: Save a screenshot (like the one below), georeference this image (based on the background basemap, using control points in Africa: Juba, Kampala, Nairobi, Harare, Lusaka etc.) and than, on the georeferenced image, vectorize the shape of Greenland.

However, I would like to find a solution using QGIS only, without importing the data. How could this be achieved?

enter image description here

Edit:

What I tried 2.0 / An idea is to use the following procedure:

  1. Set project CRS to Web-Mercator (EPSG:3857)

  2. Re-project the same data (country polygons) to a Web-Mercator (EPSG:3857) and an equal area CRS, e.g. EPSG:8857 to have a layer in each of these CRS. I used the pre-installed basic world countries polygon layer in EPSG:4326 (type world to the coordinates field at the very bottom of the QGIS main window).

  3. Use the icon Move feature from Advanced Digitizing Toolbar and move a feature from the equal area layer (see screenshot). This returns a "true size" version (but heavily distorted in shape) of the original polygon:

Yellow: layer in equal area projection, blue in Mercator - when shifted, the polygon from the equal area layer mainaints the "true size", but the original distortion, inherent in the projection, as well: enter image description here

To keep the shape, you could do the same with the other layer (in Web-Mercator). The resulting polygon would preserve the shape, but be extremely distorted in size (Greenland almost the same size as Africa). At this point, the new Feature scaling tool (available since QGIS 3.18) could be used. However, how to set an appropriate scale factor? So I guess there must be better options to achieve that.

Again the blue layer is in Mercator: it preserves shape when shifted, but size is extremely blowed up as it is inherent to Mercator projection: enter image description here

7
  • Seems like a simple translation problem (add/subtract constants to all vertex X and Y values). I'd think it would only take a dozen or two lines of code to implement. What have you tried?
    – Vince
    Apr 11, 2021 at 14:54
  • 1
    @Vince better way would be to have the feature to be moved in lat-long coordinates, and do a rotation about the earth's centre to get it where you want. A translation might only work for some equal area coordinate systems (and Mercator isn't one of them!). It should be possible to construct a proj string to do this....
    – Spacedman
    Apr 11, 2021 at 15:02
  • 1
    @Vince - translation in lat/lon is not area preserving, which is the goal of the question.
    – Llaves
    Apr 11, 2021 at 15:39
  • 1
    @Spacedman gives the rotation solution in the answer to this question- gis.stackexchange.com/questions/364238/…
    – Llaves
    Apr 11, 2021 at 16:00
  • 1
    An approximation may be done in the Mercator layer, storing the cosine of the latitude of the centroid of the original feature geometry, and scaling it when moved, through the geometry generator, by the relation between the new cosine of latitude of centroid and the original one. Apr 12, 2021 at 11:31

1 Answer 1

2

A relative simple solution would involve these steps:

  1. On the layer in Web Mercator projection (EPSG:3857), create a new attribute with field calculator, calclulating the area distortion of each polygon: divide the distorted area by the "real" area. The distorted area can simply be calculated with area($geometry) (planimetric calculation). The real area can either be taken from pre-existing data (or attributes) or as well be calculated in the field calculator using $area - this returns an ellipsoidal area (or could be calculated on another layer, re-projected to an equal area CRS). Thus to get the scale factor (area distortion), it in enough to create a new attribute with this expression: area($geometry) / $area on the layer in Web Mercator.

  2. Now use Menu Processing / Toolbox / Affine Transformation an set the Scale factor for x- and y-axis each to sqrt( 1/ "scale_factor"). You want to shrink the areas, thus 1/scale factor. As shrinking will be done in x- and y-direction (two-dimensional) and both together should result in the scale-factor, the one-dimensional shrink-factor (for x/y-axis each) is the square root (sqrt) of the scale factor for the area. enter image description here

Screenshot: for Greenland, the two-dimensional scale-factor calculated is 16.33. When applying the affine transformation with the formula from above and shifting the Greenland polygon to Africa, the result looks like this: enter image description here

It is now possible with the same method to shrink all countries worldwide to their "true-size". However, after using affine transformation, they will be mis-placed. So one has to shift them back.

This can be achieved by placing the centroid of the shrunk polygons back to the centroid of the original polygons (in Web mercator). For this, the x- and y-transformatation between the two centroids can be calculated: x-/y-coordinate value of the centroid in original Web Mercator layer minus x-/y-coordinate value of the centroid in the shrunk layer. This can be done with an expression like this one (adapting the layer and field-names) to calculate a field for x_transformation (and accordingly one for y_transformation as well):

x(
    centroid (
        geometry (
            get_feature (
                'world_mercator_3857', 
                'NAME', 
                "NAME"
            )
        )
    )
)
-
x(
    centroid (
        $geometry
    )
)

Then again use affine transformation, but this time only to shift the polygons, not scale them, using the x_transformation and y_transformation attributes calculated above. This is how the result looks like (compare with this: https://en.wikipedia.org/wiki/Mercator_projection#/media/File:Worlds_animate.gif):

enter image description here

Your Answer

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

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