Class XyzTileGrid
The standard XYZ ("slippy map") Web-Mercator tile pyramid used by web maps
such as MapLibre, Leaflet and OpenLayers: zoom z splits the EPSG:3857
world square into 2^z × 2^z tiles of 256 logical pixels, with column
x increasing east from −180° and row y increasing south from
the northern projection limit.
public static class XyzTileGrid
- Inheritance
-
XyzTileGrid
- Inherited Members
Remarks
The grid is the same one the viewer's tile renderer uses, but has no Mapsui
dependency, so headless tools (the s100 tiles export command) can share it.
Fields
Extent
Half the EPSG:3857 world extent in metres (π · 6378137). The grid
spans [-Extent, +Extent] on both axes.
public const double Extent = 20037508.342789244
Field Value
MaxZoom
The largest zoom level the grid supports.
public const int MaxZoom = 24
Field Value
TileSize
Tile edge length in logical pixels.
public const int TileSize = 256
Field Value
Methods
Columns(int, double, double)
The tile columns at zoom that intersect the world-X
span minX to maxX, in ascending
order and without duplicates.
public static IReadOnlyList<int> Columns(int zoom, double minX, double maxX)
Parameters
zoomintThe zoom level.
minXdoubleThe western edge, in EPSG:3857 metres.
maxXdoubleThe eastern edge, in EPSG:3857 metres.
Returns
Remarks
The span may extend past ±Extent, as it does for data kept in a 0…360° frame or a seam-aware extent that crosses the antimeridian. The columns past either edge wrap around onto the canonical grid.
Resolution(int)
The EPSG:3857 resolution, in metres per logical pixel, at
zoom.
public static double Resolution(int zoom)
Parameters
Returns
Rows(int, double, double)
The first and last tile rows at zoom that intersect the
world-Y span minY to maxY, clamped to
the grid.
public static (int First, int Last) Rows(int zoom, double minY, double maxY)
Parameters
zoomintThe zoom level.
minYdoubleThe southern edge, in EPSG:3857 metres.
maxYdoubleThe northern edge, in EPSG:3857 metres.
Returns
ScaleDenominator(int, double)
The S-100 display scale denominator of zoom at
latitude, using the 0.28 mm nominal pixel of
DenomToResolutionMetres.
public static double ScaleDenominator(int zoom, double latitude)
Parameters
Returns
Remarks
Web-Mercator stretches the ground by 1 / cos(latitude), so one zoom
level shows a different true scale at each latitude.
TileWorldBounds(int, int, int)
The EPSG:3857 bounds of a tile, in metres.
public static (double MinX, double MinY, double MaxX, double MaxY) TileWorldBounds(int zoom, int x, int y)
Parameters
zoomintThe zoom level.
xintThe tile column (0 at −180°).
yintThe tile row (0 at the northern limit).
Returns
TileWorldSize(int)
The world size of one tile at zoom, in EPSG:3857 metres.
public static double TileWorldSize(int zoom)
Parameters
Returns
TilesPerAxis(int)
The number of tiles along one axis at zoom (2^zoom).
public static int TilesPerAxis(int zoom)
Parameters
Returns
ZoomForScaleDenominator(double, double)
The zoom level whose display scale at latitude is
closest (in log space) to scaleDenominator, clamped to
0 to MaxZoom.
public static int ZoomForScaleDenominator(double scaleDenominator, double latitude)
Parameters
scaleDenominatordoubleThe scale denominator, such as 50 000 for 1:50 000.
latitudedoubleThe latitude, in degrees, the scale is measured at.