If I need to generate a polygon that crosses the anti-meridian, does it exists a Python library that treat such cases (partitioning such polygon and generate a multipart polygon)?

3 Answers 3


I would suggest looking into Xarray here is a thread xarray slicing across the antimeridian that covers a use for perhaps what you are looking for.

This thread isn't answered but provides another example Shapely polygons crossing the antimeridian

Here is a blog entry How to correct a linestring for the antimeridian (180 longitude) to provide additional context.

enter image description here

  • Nice suggestions. I've found another question on the same line using gdal.VectorTranslate. Have you tried to use this method? (I'm having issues to install gdal 2.1.x on my mac, so I haven't tested) Sep 12, 2017 at 18:42
  • I haven't had a chance to try the line you suggested.
    – whyzar
    Sep 12, 2017 at 18:44

In a context of GeoJSON files (in which I was inserted) I've preferred to use a solution that uses gdal.VectorTranslate method, because it provides compliance to the RFC 7946 standard, that also provides a rationale for antimeridian cases.


Splitting a polygon along the antimeridian can potentially much more involved than expected. In Python, we can use the Shapely library to accomplish this with the following steps

  1. Taking a given polygon's coordinates (in GeoJSON format), then detecting whether there are antimeridian crossings by checking if the absolute value of the longitudinal difference between two consecutive vertices of the polygon is greater than a certain threshold. Practically, 180 degrees could be a sensible threshold value.
  2. If there are antimeridian crossing, you will next need to determine the direction (e.g. is it going from +179.9 to -179.9 or vice versa). Once you know the direction, you can shift certain vertices of the polygon into a new Cartesian space. For example, consider the case of the previous vertex at +179.9 the the current vertex at -179.9:
    • we can shift the current vertex to +180.1 in our new Cartesian space
    • we note down that the antimeridian crossing is a line at +180.0 of longitude
  3. Once the entire polygon's vertices have been appropriately shifted into the new Cartesian space, we can then leverage Shapely's Cartesian geometry operations (particularly the shapely.ops.split function) to split the polygon safely.
  4. Finally, for each of the resultant polygons from the split operation, you'll need to shift their longitude values to appropriate geographic coordinates (+/- 360.0)

Here's the full tutorial + code snippets using Shapely.

  • Link-only answers risk deletion as non-answers.
    – Vince
    Jun 11, 2021 at 22:50
  • Added high level overview of the logic
    – pawarit28
    Jun 13, 2021 at 2:34

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.