Skip to content

Fractional zoom level in tile URLs. (Edit) #448

@danallsop

Description

@danallsop

Migrated from: Leaflet#9930
Original author: danallsop
Original created: 2025-10-06T10:59:11Z


Checklist

  • I've looked at the documentation to make sure the behavior isn't documented and expected.
  • I'm sure this is an issue with Leaflet, not with my app or other dependencies (Angular, Cordova, React, etc.).
  • I've searched through the current issues to make sure this hasn't been reported yet.
  • I agree to follow the Code of Conduct that this project adheres to.

Steps to reproduce

When having non-integer zoomSnap option and calling map.redraw() method, it may result in fractional zoom level in tile URL, like 2.4396229271192125/0/2. It can happen after view is set by setView(), fitBounds() or similar methods. Zooming in and out by mouse wheel normalizes the situation and map is loaded.
Seems this place in code is missing Math.round() call:
https://github.com/Leaflet/Leaflet/blob/2f5594810c26aa87019582d381960f1b10c1bf62/src/layer/tile/GridLayer.js#L235

Expected behavior

Tiles are always requested with integer coordinates.

Current behavior

Tiles may be requested with fractional Z coordinate.

Minimal example reproducing the issue

No response

Environment

  • Leaflet version: 1.9.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdevin-assessedIssue has been assessed by Devin automated remediation pipelinedevin-cannot-reproduceDevin automated pipeline could not reproduce this bugmanual-onlyneeds triageTriage pending

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions