5

In QGIS 3.16, I'm preparing a map of the emperor penguin colonies in the Antarctica, using the data from the Quantarctica project, but I'm facing a couple of issues with the grid created in the print composer. I set the following variables

enter image description here

And this is what I've been able to produce

enter image description here

First, as you can see, the Antimeridian is not represented. Second, any attempt to obtain the Parallels, setting any interval in the Y axis, produces straight lines from Meridian to Meridian, instead of concentric circles from the South Pole. I guess it's a matter of projection and I've tried different EPSGs without success. Any suggestions to overcome these issues?

3

1 Answer 1

4

You can create the grid lines using geometry generator by creating buffers around the south pole. The distance between Degrees of Latitude is ca. 111 km. Use this value and mulitply it, using array_foreach to create several grid lines at once, here with an interval of 5 degrees (last number in line 3). For adding the antimeridian, see below.

Use this expression: this works if the layer in question is in EPSG:4326! If the layer is in EPSG:3031, delete the transform() function (lines 4 and 9 to 11):

collect_geometries (
    array_foreach(
        generate_series (0,30, 5),
        transform (
            buffer (
                make_point (0,0), 
                111000*@element, 
                200
            ),
            'EPSG:3031', 
            'EPSG:4326'
        )
    )
)

Red lines generated with geometry generator and the expression from above; the layer is in EPSG:4326: enter image description here

enter image description here

Edit: adding antimeridian

On my first screenshot, the antimeridian seems to appear. This is because I (accidentally) set an offset of 5 degrees for x - so in fact it is not the antimeridian. Maybe that's a bug.

To add the antimeridian, use the same approach: create it with geoemtry generator. For a layer in EPSG:3031, use this expression - if the layer is in EPSG:4326, delete lines 1 and 5 to 7:

transform (
    make_line (
        make_point (0,-90),
        make_point (180,0))
    ,
    'epsg:4326',
    'epsg:3031'
)

You can combine both expressions (for parallels and the antimeridian) in one expression using collect_geometries (expression_1, expression_2) (or, similarily, the union() function). Be aware to keep or delete the transform() function, depending on the layer's CRS. One of the two expressions must have the transform, the other not. As well, the parallels (from the expression above) need to be converted to lines with the function boundary().

So for a layer in EPSG:4326, the expression is (for EPSG:3031 see screenshot):

collect_geometries( 
    collect_geometries (
        array_foreach(
            generate_series (0,30, 5),
            transform (
                boundary (
                    buffer (
                        make_point (0,0), 
                        111000*@element, 
                        200
                    )
                ),
                'EPSG:3031', 
                'EPSG:4326'
            )
        )
    ),
    make_line (
        make_point (0,-90),
        make_point (180,0)
    )
)

Screenshots, using a layer in EPSG:3031: enter image description here

enter image description here

3
  • 2
    Wonderful @Babel, a nice demonstration of geometry generator power, again
    – simo
    Dec 17, 2021 at 15:57
  • 1
    @Babel, how did you manage to get the Antimeridian (180º) represented? I think I've used the same grid settings and it doesn't show on my map.
    – jpinilla
    Dec 17, 2021 at 18:41
  • See updated answer with additions: 1) Why in may 1st screenshot there seems to be an antimeridian (there is not, in fact....) and 2) how to add the antimeridian using the same approach.
    – Babel
    Dec 17, 2021 at 21:13

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.