Table of Contents

Class XyzTileGrid

Namespace
EncDotNet.S100.Rendering.Scene
Assembly
EncDotNet.S100.Rendering.Scene.dll

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

double

MaxZoom

The largest zoom level the grid supports.

public const int MaxZoom = 24

Field Value

int

TileSize

Tile edge length in logical pixels.

public const int TileSize = 256

Field Value

int

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

zoom int

The zoom level.

minX double

The western edge, in EPSG:3857 metres.

maxX double

The eastern edge, in EPSG:3857 metres.

Returns

IReadOnlyList<int>

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

zoom int

The zoom level (0 to MaxZoom).

Returns

double

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

zoom int

The zoom level.

minY double

The southern edge, in EPSG:3857 metres.

maxY double

The northern edge, in EPSG:3857 metres.

Returns

(int Row, int Col)

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

zoom int

The zoom level.

latitude double

The latitude, in degrees, the scale is measured at.

Returns

double

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

zoom int

The zoom level.

x int

The tile column (0 at −180°).

y int

The tile row (0 at the northern limit).

Returns

(double South, double West, double North, double East)

TileWorldSize(int)

The world size of one tile at zoom, in EPSG:3857 metres.

public static double TileWorldSize(int zoom)

Parameters

zoom int

The zoom level (0 to MaxZoom).

Returns

double

TilesPerAxis(int)

The number of tiles along one axis at zoom (2^zoom).

public static int TilesPerAxis(int zoom)

Parameters

zoom int

The zoom level (0 to MaxZoom).

Returns

int

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

scaleDenominator double

The scale denominator, such as 50 000 for 1:50 000.

latitude double

The latitude, in degrees, the scale is measured at.

Returns

int