ConstConvert lat/lng to tile coordinates (Web Mercator projection)
Delegates to tile-math.js. defaults.webMercatorMaxLat is forwarded explicitly
so that mutating it on this object stays effective.
Latitude
Longitude
Zoom level
Tile coordinates
Build tile URL from template
URL template with {x}, {y}, {z} placeholders
Tile X coordinate
Tile Y coordinate
Zoom level
Complete tile URL
Calculate bounds from layer geometries
⚠️ resource.url is not trusted: the enumerated resource list is fed, among
others, by StyleResolver from a REMOTE TileJSON, so a hostile document can put an
arbitrary URL in it. Each entry is scheme-guarded before it is fetched; a refused
one is skipped like any unreadable layer, so one poisoned entry cannot blind the
whole bounds computation (CAPACITÉS B.10).
Unused. Kept in the signature so the four calculate* members share
one call shape; bounds come from resources alone.
The enumerated resources; only type: "layer" entries contribute.
Bounds { north, south, east, west }, or null if no layer was readable.
Extract all coordinates from a geometry
GeoJSON geometry object
Array of [lng, lat] coordinates
Estimate total size of tiles
Number of tiles
OptionalavgSize: number
Average size per tile in bytes
Estimated size in bytes
Calculate total size of resources
Array of resource objects with size property
Total size in bytes
Format bytes to human-readable string
Size in bytes
Optionaldecimals: number = 2
Number of decimal places
Formatted string (e.g., "1.23 MB")
Estimate download time based on size and connection speed
Size in bytes
OptionalspeedMbps: number = 10
Connection speed in Mbps
Estimated time in seconds
Format time duration to human-readable string
Duration in seconds
Formatted string (e.g., "2h 30m 15s")
How many tiles cover bounds at zoom — the figure the per-zoom cap is judged on.
Area covered.
Zoom level.
The tile count.
Enumerate all tile URLs for a layer or basemap
Layer or basemap configuration; supplies the bounds and zoom range.
Unused, kept for call-shape compatibility with the sibling members.
Optionaltrace: TilePreparationTrace
Where to record the zooms left out and a stop at the total cap, so the preparation can be read back later; nothing is recorded without one.
One entry per tile, { url, type: "tile", x, y, z }.
CacheCalculator Pure calculation logic for cache operations Extracted from cache-manager.js (Phase 5)