Skip to content

fix(geojson-layer): enable wrapLongitude for antimeridian crossing polygons - #3332

Closed
pierreeurope wants to merge 1 commit into
keplergl:masterfrom
pierreeurope:fix/antimeridian-wrap-longitude-2668
Closed

fix(geojson-layer): enable wrapLongitude for antimeridian crossing polygons#3332
pierreeurope wants to merge 1 commit into
keplergl:masterfrom
pierreeurope:fix/antimeridian-wrap-longitude-2668

Conversation

@pierreeurope

Copy link
Copy Markdown
Contributor

Summary

Enable wrapLongitude on GeoJSON layers so that polygons crossing the -180/180 longitude boundary (antimeridian) are rendered correctly and can be displayed simultaneously.

Problem

Two polygons on opposite sides of the antimeridian cannot be viewed at the same time (#2668). This is because the GeoJSON layer explicitly sets wrapLongitude: false, overriding the base layer's default of true.

Fix

Change wrapLongitude from false to true in the GeoJSON layer's deck.gl layer configuration. This enables deck.gl's built-in antimeridian wrapping support, which correctly handles geometries that cross the -180/180 boundary.

The base layer (base-layer.ts) already uses wrapLongitude: true — the GeoJSON layer was inconsistently overriding it to false without a documented reason.

Fixes #2668

Enable deck.gl's wrapLongitude option in the geojson layer so polygons
crossing the -180/180 longitude boundary are rendered correctly on both
sides of the antimeridian.

Updated test expectations to match the new default.

Fixes keplergl#2668

Signed-off-by: pierreeurope <pierre.europe@pm.me>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a rendering issue where polygons crossing the antimeridian (-180/180 longitude boundary) could not be displayed simultaneously in GeoJSON layers. The fix enables deck.gl's built-in wrapLongitude feature, aligning the GeoJSON layer with the base layer's default behavior.

Changes:

  • Changed wrapLongitude from false to true in GeoJSON layer rendering to enable antimeridian wrapping
  • Updated test expectations to reflect the new wrapLongitude: true value

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/layers/src/geojson-layer/geojson-layer.ts Enabled wrapLongitude for both main and hover GeoJSON layers, allowing proper rendering of polygons crossing the antimeridian
test/browser/layer-tests/geojson-layer-specs.js Updated test expectations to verify wrapLongitude: true is correctly set on polygon fill and stroke layers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lixun910 lixun910 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @pierreeurope !

@igorDykhta

Copy link
Copy Markdown
Collaborator

This caused issues before

@igorDykhta igorDykhta closed this Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Two polygons crossing -180/180 longitude are not shown at the same time (same layer)

4 participants