Turfjs / Turfjs/turf

bbox longitudes incorrect for geojson FeatureCollection spanning the anti-meridian

Open
#2,061 7 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

@turf/bbox antimeridian
Dominant language
TypeScript
Stars
10.5k
Forks
1k
Avg merge
1h 11m
Merged PRs (30d)
4

Description

turf 6.3.0

Here is a link to geoJson from the US Census TIGER web that spans the antimeridian:

US Census TIGER Alaska outline

02 is the FIPS state code for Alaska.

This geoJson is a FeatureCollection with one Feature, a MultiPolygon with 50 components of coordinates.

turf.bbox(alaskaFeatureCollection) =>

[-179.23108599959195, 51.17509200018345, 179.85968100035376, 71.43978600002835]

The latitudes are correct but the longitudes are not.

For comparison:

d3.geoBounds(alaskaFeatureCollection) =>

[[172.34784599966287, 51.17509200018345], [-129.97416699982122, 71.43978600002835]]

Thank you for this project.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the turf.bbox entry point and reproduce the result with the linked Alaska GeoJSON FeatureCollection, comparing it with d3.geoBounds. Trace how the MultiPolygon's longitude values are aggregated across the antimeridian; done means the bounding longitudes match the expected antimeridian-spanning bounds while the latitudes remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.