I've imported a vector layer with extents between two hemispheres near the antimeridian. Unfortunately, instead of having the geometry split in two, where one part lies east of the antimeridian, and another west of this meridian, it is stretched across the entire map. Moreover the nodes seems to be mirrored. This means that the polygon isn't where it should be, everywhere is it outside of its bounds.

Image showing correct and incorrect rendering of this shape over the antimeridian

The blue one is correct, the pink one incorrect.


3 Answers 3


The principle

The solution consists of a few simple steps: reproject your polygon to a Pacific-centered CRS and create a line for the antimeridian in the same CRS. Create a small buffer around this line and substract it with the Difference too from the polygon.

See below for screenshots.

How to do that in detail, step by step:

  1. Re-project your layer (polygon) to a pacific-centered CRS. I used EPSG:3832.

  2. Create a line following the antimeridian (180th meridian). You can do this as follows: create a new, empty point layer in EPSG:4326 and add one feature, don't care where. Than run Menu processing / Toolbox / Geometry by expression, set this layer as input and line as output style with this expression: make_line (make_point (180, 85), make_point (180,-85)): this creates a line along the 180 degree meridian, from 85 degrees south to 85 degrees north.

  3. The line we created consists only of two vertices. When we re-project it, only these two points get re-projected and the line will be drawn straight in between - thus it will pass through different locations, based on projection (see this for a similar case). Thus we must densify (add additional vertices) to keep the shape along the antimeridian even when re-projecting.

    For this, use Menu processing / Toolbox / Densify by count, set the line created in step 2 as input and define the number of additional vertices: I chose a number of 10.000. Very roughly, this corresponds to vertices with an interval of less than 2 km.

  4. Now re-project this densified line to the same CRS used in step 1.

  5. The densified antimeridian in EPSG_3832 from step 4 follows more or less the antimeridian, but not exactly: we put a vertex every 2 km or less, remember. Thus this line still crosses the actual antimeridian here and there. To be able to clearly separate what is to one side and what is to the other side, we apply a buffer( this is based on this solution by @Gabriel De Luca).

    Thus run Menu Vector / Geoprocessing / Buffer, set the line from step 4 as input and the buffersize to a small value (I was successfull with a size of 0.1 meters).

  6. Run Menu Vector / Geoprocessing / Difference, set the polygon layer from step 1 as Input layer and the buffer around the antimeridian from step 5 as Overlay layer. Again: be sure that both are in the same, Pacific-centered CRS. Run the tool.

You're done. Optional: run Menu Vector / Geometry Tools / Multipart to singleparts to get separate features.

Screenshot 1: The polygon in a pacific-centered CRS (EPSG:3832) on both sides of the antimeridian (black line). Red outlined (original polygon) as well as yellow polygon (solution) appear identical: enter image description here

Screenshot 2: Same situation as above, but project CRS changed to EPSG:3857 (Web Mercator): the original polygon (red outline) streches over the whole canvas. The solution (yellow polygon) is split and appears in two parts: enter image description here

Screenshot 3: again same situation, this time with project CRS changed to EPSG:4326. original polygon (red outlined) reaches out of the underlying basemap extent, whereas the yellow polygon again is correctly split in two parts. The OpenStreetMap basemap does not fit - this has nothing to do with the soution, this is a known issue with QGIS and project CRS in 4326 when zooming out: enter image description here

  • Yeah! That's cool! Quite a lot of wor, but still more convenient, than redrawing it completely. I also thought about about this option: gis.stackexchange.com/questions/339113/… but regrettably it works only for lines
    – Geographos
    May 17, 2021 at 13:33
  • 1
    If you use that more often, consider buildig a model from this workflow.
    – Babel
    May 17, 2021 at 13:34
  • 1
    I already thought about keeping the buffered line and next start just from this moment. Would it be helpful?
    – Geographos
    May 17, 2021 at 13:36
  • Yeah, of course.
    – Babel
    May 17, 2021 at 13:37
  • 1
    If you create a model, would be nice sharing it, e.g. on Github.
    – Babel
    May 17, 2021 at 13:38

I think I found also another way to do it, although it might not be perfect enough.

enter image description here

When the layer exceeds the antimeridian and is stretched across the entire map by the CRS EPSG: 3857 used, it corresponds to the same situation for the WGS84 EPSG:4326 CRS. However there, as you can see in the image attached, thhe layer is not stretched but goes beyond the map canvas.

In this event, 2 things will be helpful.

  1. Stretch line, which can be created both by using Toolbox -> Geometry by expression as well as the Quick WKT plugin, where we can define three points for our LINESTRING selection (i.e. LINESTRING (-180 10, 0 10, 180 10)). In this situation, we will have a straight line along some particular latitude.
  2. Advanced digitized toolbar - Split features. Here we can mark the polygon along which borders we want to split our editable layer.

When you split your layer nearby the antimeridian, then drag the created WKT linestring roughly to the latitude, at which the element was cut (preferably from the top). Next use the Advanced Digitizing Toolbar -> Move feature and drag the cut bit to the opposite side of the map by keeping firmly the same latitude as pointed out by the WKT line string. enter image description here

As a result, your layer will appear on both sides of the antimeridian.

enter image description here


You could split the polygon and create a multi-polygon.

Here is what I would do:

  1. "correct" negative x-values of the geometries so it "overflows" the projection's extent (basically -173 will become 187)
  2. cut the polygon using a very thin buffer at the longitude 180 using the Difference tool which will create a multi-polygon
  3. undo/correct the changes to the geometries (187 becomes -173 again) which are overlapping and the multi-polygon has 2 parts on both sides of the map

I wrote a QGIS Processing tool:

enter image description here

Note: The Control Meridians are used to detect polygons to be corrected. The tool corrects all polygons which crosses these meridians.

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.