mapbox / mapbox/geo-viewport

Zoom is NaN when using rectangular bounds

Open
#21 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
197
Forks
39
PR merge metrics
No merged PRs in 30d

Description

When calling `geoViewport.viewport([33.841629, -118.91905, 34.27888, -117.954399], [384, 318]);`, I get the following results:

```
center: (2) [34.0602545, -118.4367245]
zoom: NaN
```

It seems to work fine when using a fixed value (`[34.16811, -118.231895, 34.16811, -118.231895]`), so I'm guessing I must be doing something wrong with the data I'm passing in.

Any ideas?

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 by reproducing the call to geoViewport.viewport with the rectangular bounds and [384, 318] size, then inspect the viewport calculation that produces the zoom value. Compare it with the fixed-value example and verify that the rectangular case returns a finite zoom rather than NaN; add or update a regression test if the repository provides one.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.