OvertureMaps / OvertureMaps/data

division_area bbox values are incorrect for regions crossing the antimeridian

Open
#345 0 comments 2 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

divisions
Dominant language
Python
Stars
1.2k
Forks
47
Avg merge
3h 42m
Merged PRs (30d)
1

Description

Alaska is a perfect example of this. It looks like bbox is being calculated using a simple ST_Envelope(geometry) call, shown in the following query direct from the most recent overture release:

Image

Here is this bbox shown on a map:

Image

The core issue here is in the xmin and xmax which are miscalculated due to Alaska's area geometry spanning across the antimeridian.

We can fix this using PostGIS' ST_WrapX or ST_TransformLongitude to handle the "wraparound" problem by reprojecting the coordinates before calculating the envelope. Here is my suggested fix in action:

Image

And this correct bbox for Alaska rendered on a map:

Image

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.