GeoLeaf Core API - v3.0.0
    Preparing search index...
    • Converts a scale denominator (the X in 1:X) to the MapLibre zoom level that renders it at lat — the exact inverse of calculateMapScale.

      Lets the engine carry a constraint the profile expresses in the user's unit (scale) while MapLibre only speaks zoom. The conversion depends on latitude, not on zoom: that is why a scale bound cannot be a fixed minzoom in general, and why callers only need to recompute when the latitude moves — never when the user zooms.

      Because the denominator grows as you zoom out, the mapping is order-preserving here: minScale (widest view, larger number) → minzoom, maxScalemaxzoom.

      Parameters

      • scale: number | null | undefined

        Scale denominator. <= 0 or non-finite means "no constraint" → null.

      • lat: number

        Latitude the bound is evaluated at, in degrees.

      Returns number | null

      The zoom level, clamped to MapLibre's [0 ; 24], or null if unconstrained.