Struct ZoomLevel
An integer tile zoom level, validated at construction.
public readonly struct ZoomLevel : IEquatable<ZoomLevel>
- Implements
Remarks
Zoom 0 is one tile covering the world; each level doubles the grid in both axes. The ceiling of 28 is a storage constraint, not a cartographic one: Key packs an address as z<<58 | y<<29 | x, which leaves 29 bits per axis and so allows at most zoom 28. No tile provider serves anywhere near that; the deepest preset here stops at 22.
Constructors
ZoomLevel(int)
Creates a zoom level, rejecting out-of-range values.
public ZoomLevel(int value)
Parameters
Exceptions
- ArgumentOutOfRangeException
The value is negative or above Max.
Fields
Max
The deepest representable level, 28, set by the packed-key bit layout rather than by any provider.
public const int Max = 28
Field Value
Properties
TileCount
Tiles along one axis at this level, 2^Value. The full grid is this squared.
public int TileCount { get; }
Property Value
Value
The level, 0 to Max.
public int Value { get; }
Property Value
Methods
Equals(ZoomLevel)
Equality on the level value.
public bool Equals(ZoomLevel other)
Parameters
otherZoomLevel
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns "z" followed by the level, e.g. "z14".
public override string ToString()