Skip to content

fix: round zoom level, osm.org will floor it#324

Merged
nilsnolde merged 1 commit intomasterfrom
nn-osm-zoom-round
Jan 30, 2026
Merged

fix: round zoom level, osm.org will floor it#324
nilsnolde merged 1 commit intomasterfrom
nn-osm-zoom-round

Conversation

@nilsnolde
Copy link
Member

🛠️ Fixes Issue

fixes #322 (not really, but since osm.org won't change their url parsing, this is as close as we get)

👨‍💻 Changes proposed

osm.org floors any incoming zoom float, this PR rounds it to the nearest integer first.

@gisops-bot
Copy link

Preview is ready! 🚀 You can view it here: https://valhalla-app-tests.gis-ops.com/324

@nilsnolde
Copy link
Member Author

nilsnolde commented Jan 30, 2026

for some reason I can't run the unit test, e.g.

 ❯ src/components/tiles/valhalla-layers-toggle.spec.tsx (17 tests | 5 failed) 467ms
       ✓ should render without crashing 31ms
       ✓ should render toggle label 8ms
       ✓ should render description text 4ms
       ✓ should render Tile API link 112ms
       ✓ should render switch in unchecked state by default 16ms
       ✓ should not render when map is not ready 1ms
       × should add source when toggled on 42ms
       × should add all layers when toggled on 40ms
       × should remove all layers when toggled off 44ms
       × should remove source when toggled off 39ms
       ✓ should not add source if already exists 23ms
       × should not add layer if already exists 23ms
       ✓ should update checked state when toggled 22ms
       ✓ should register styledata event listener 4ms
       ✓ should unregister styledata event listener on unmount 4ms
       ✓ should sync enabled state with source existence on style change 18ms
       ✓ should set enabled to false when source is removed on style change 34ms

and stuff like

 FAIL  src/utils/base-url.spec.ts > base-url > testConnection > should normalize URL before testing
TypeError: localStorage.clear is not a function
 ❯ src/utils/base-url.spec.ts:16:18
     14| describe('base-url', () => {
     15|   beforeEach(() => {
     16|     localStorage.clear();
       |                  ^
     17|   });
     18| 

with totals of

 Test Files  7 failed | 42 passed (49)
      Tests  134 failed | 638 passed (772)
     Errors  7 errors

do you have a gut feeling why @mustaphaturhan ?

@mustaphaturhan
Copy link
Collaborator

@nilsnolde that is interesting. is it failing with a reason? can you try removing node_modules and running npm install again?

@nilsnolde nilsnolde merged commit 185225b into master Jan 30, 2026
3 checks passed
@nilsnolde nilsnolde deleted the nn-osm-zoom-round branch January 30, 2026 12:06
@nilsnolde
Copy link
Member Author

@mustaphaturhan the output is super huge, the above is a small example. there's many reasons why individual tests fail. I reinstalled already, didn't change. turns out it was the node version, system has node v25.2.1, when I install 22.x it runs smoothly.

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.

"Open OSM" open osm.org on different zoom level

3 participants