Skip to content

Buffer should split polygons at the antimeridian #3029

@mfedderly

Description

@mfedderly

The current behavior of the buffer package is that it will normalize longitude values to [-180, 180], but the way that it does this can result in very large polygons that span the world, instead of much smaller shapes around the antimeridian itself.

I think that the expected behavior here is to split the polygons down the antimeridian, so a rectangle from -181 to -179 would turn into one from 179 to 180 and another from -180, -179. I believe this would be a breaking change, so I'd like to file this away for v8 before changing the behavior. Happy for feedback on this ticket in the meantime.

Interestingly Mapbox seems to wrap the world, but Cesium decides that this should cross the antimeridian instead. I suspect that Cesium is determining that the points are more than 180 degrees apart in longitude and joins them in the opposite direction instead. For the curious, Mapbox renders longitudes outside [-180, 180] in a predictable way, so it is possible to visually span the antimeridian by denormalizing the longitudes before rendering.

Cesium rendering of a box (with a hole in it) at the antimeridian and equator:
Image

Mapbox rendering of the same output geojson:
Image

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions