3

I need to create a polygon in a vector layer containing all the "sunbelt" region (that's the area between 40°N to 40°S) in CRS "World_Mollweide" (EPSG: 54009) in order to use it as mask layer to clip it with a raster image that was created in CRS "World_Mollweide". Any ideas how I can create such a shape without doing this manually and therefore omitting some areas on the lateral edges (see red circles in the screenshot) Mollweide_World view with an incomplete polygon for the sunbelt area and red circles showing the missing gaps

I am using QGIS 3.18.3

Babel
  • 71,072
  • 14
  • 78
  • 208
Tobias
  • 111
  • 6

1 Answers1

2

The problem

You need to cover the whole layer extent, but lines are drawn between vertices always as straight lines on the map canvas (in the selected project CRS). Add additonal vertices to approximate the curved outer boundary of the World Mollweide projection. See here for a similar problem.

Quick answer / generic solution (not software specific)

First create a polygon covering the extent of the map canvas in a projection that is rectangular. Than densify this polygon (add additional vertices).

Detailed answer for QGIS

Proceed the following, simple steps to get this resulting polygon hachured in red with extent form 40° N to 40° S:

enter image description here

  1. Create a new project and a new (temporary) layer with just one feauture in a projection with rectangular extent. I used EPSG:3857 (web mercator) and created one point somewhere on the map. It's just an auxiliary layer as you need an input layer to create a new geometry (step 2).

  2. Use Menu Processing / Toolbox / Geometry by expression, set the layer created in step 1 as input, set output to Polygon and use this expression to create a rectangular polygon with the extreme points of the WebMercator projection (the maximum/minimum extent, covering the whole layer extent). If you want only from 40° N to 40° S, replace the values of +/-85.051129 with +/-40:

transform (
    make_polygon (
        make_line (
            make_point ( -180.000000, -85.051129),
            make_point ( 180.000000, -85.051129),
            make_point ( 180.000000, 85.051129),
            make_point ( -180.000000, 85.051129)
    )),
    'EPSG:4326' ,
    'EPSG:3857' 
)
  1. Use Menu Processing / Toolbox / Densify by interval. Set the layer from step 2 as input and select a value for Interval between vertices to add of e.g. 1000 [meters].

You're done! Project your map to World_Mollweide by setting the project CRS at the very bottom right in your QGIS window (not the layer CRS) to EPSG:54009. The densified polygon is still in WorldMercator/EPSG:3857, but the densified vertices smoothly reproject on the fly to the projection of the map canvas (project CRS).

If you want, you can re-project the densified layer to EPSG:54009 by either right-clinging layer / Export / Save Features As... or using Menu Processing / Toolbox / Reproject layer and selecting EPSG:54009.

Same procedure, but for the whole extent of EPSG:3857 enter image description here

Babel
  • 71,072
  • 14
  • 78
  • 208