2

I am working on a Python script in QGIS 3 that creates buffers around points in Web Mercator (EPSG:3857) and transforms the buffers into WGS84 (EPSG:4326).

I have a problem with geometries that cross antimeridian (180 deg longitude) - after transformation the buffers (circles) show up as long rectangles that span from -180 to +180 longitude, with actual buffers (circles) being "excluded" from these geometries.

Fig. 1: Buffer in Web Mercator that crosses antimeridian

Buffer crossing antimeridian

Fig. 2: Buffer after transforming into WGS84

Buffer after transforming into WGS84

How best to transform geometries that span across antimeridian?

Is there a way to fix the output geometries?

6
  • 1
    If you want to use geometries that cross the antimeridian you need to use a projection that is not split by it, or split the geometry.
    – Ian Turton
    Oct 15, 2020 at 18:52
  • Thanks @IanTurton for your suggestion. However, why it is possible to create and display a polygon (buffer) that crosses the antimeridian? I've tried both ways: from WGS84 to WebMercator and the other way round. I can create a buffer in both coordinate systems and they show correctly. The issue arises only when the geometry is transformed to another coordinate system.
    – jan_b
    Oct 15, 2020 at 21:26
  • 1
    I worked on a project where I had to create custom Coordinate Systems for global earthquake points. I ran into a very similar problem. My question doesn't deal with the problem directly but it may help you gis.stackexchange.com/questions/263379/…
    – ziggy
    Oct 15, 2020 at 22:31
  • 1
    Likely your “native” buffer in either coordinate system results in points outside the official bounds, eg longitudes > 180 or < 180. These display correctly on many maps. When you convert, the conversion probably normalizes the points to the official bounds, breaking the display. Oct 16, 2020 at 2:44
  • 1
    @ziggy - feel free to add your comment as an answer so I can mark the question as answered and give you credits.
    – jan_b
    Oct 16, 2020 at 8:04

0

Your Answer

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

Browse other questions tagged or ask your own question.