ElevationRasterTileSource¶
Namespace: ThinkGeo.Core
Serves an elevation sampler as raster-dem tiles for the GPU engine. Hand it to MapStyle.SetTerrain(new RasterDemSource(source, source.Encoding)) and the whole DEM pipeline lights up from the sampler: terrain, hillshade, and the elevation queries all read the tiles it cuts.
public class ElevationRasterTileSource : RasterTileSource, System.IDisposable
Inheritance object → RasterTileSource → ElevationRasterTileSource
Implements IDisposable
Remarks:
The sampler answers "the elevations covering this Web Mercator extent at width x height samples" with floats - NaN where it has no answer, which encodes as 0 m, the same sea-level neutral the terrain assumes where tiles are missing entirely. A local DEM file is one wiring line away: GdalElevationSource in the GDAL extension reads any elevation raster GDAL opens, and its ReadElevations is exactly this delegate's shape. Tiles are encoded with , the exact inverse of the decode the engine applies.
Properties¶
Encoding¶
How the tiles' RGB encodes metres: always DemEncoding.Terrarium. What a RasterDemSource over this source is told.
public DemEncoding Encoding { get; }
Property Value¶
IsOpen¶
public bool IsOpen { get; }
Property Value¶
TileMatrixSet¶
Gets the tile grid this source PUBLISHES on: one TileMatrix per zoom level, indexed by zoom. The native grid, or the reprojection target when the tiles are being republished onto another grid.
public TileMatrixSet TileMatrixSet { get; }
Property Value¶
DrawsFallbackTiles¶
Gets or sets a value indicating whether a tile of this source, magnified from a shallower zoom, is worth showing while the tiles for the current one arrive.
public bool DrawsFallbackTiles { get; set; }
Property Value¶
Remarks:
True for imagery, and the default: a magnified aerial is a blurred version of the truth, in the right place, and it beats a hole in the map for the second or two the new tiles take.
Set it false for a source whose tiles are symbols drawn at a fixed size - a WMS of points or labels on nothing. Magnifying one of those does not blur it; it draws the symbols at the wrong size, beside the correctly sized ones in the cells that have already arrived. Measured on a service taking 1.2 s a tile, that is the whole of the transition. With this false the cells simply stay empty until their own tiles come, and whatever is under the layer shows through.
It says nothing about tiles that have arrived. A loaded tile always replaces the zoom beneath it across its whole footprint, transparent pixels included.
https://community.thinkgeo.com/t/bug-gpu-raster-tiles-from-previous-zooms-remain-visible/12479
TileSize¶
Gets the edge length, in pixels, of the tiles this source publishes.
public int TileSize { get; }
Property Value¶
MinDataZoom¶
The shallowest zoom level tiles exist at. A subclass that learns the range from the data - an archive header, a service capability - records it through at open.
public int MinDataZoom { get; }
Property Value¶
MaxDataZoom¶
The deepest zoom level tiles exist at; deeper views reuse this level's tiles (overzoom). See RasterTileSource.MinDataZoom.
public int MaxDataZoom { get; }
Property Value¶
Constructors¶
ElevationRasterTileSource(RectangleShape, double, Func<RectangleShape, int, int, Single[]>)¶
Initializes a new instance over an elevation sampler.
public ElevationRasterTileSource(RectangleShape extent, double metersPerPixel, Func<RectangleShape, int, int, Single[]> readElevations)
Parameters¶
extent RectangleShape
The ground the sampler covers, in Web Mercator; tiles beyond it are not cut.
metersPerPixel double
The sampler's ground resolution, which decides the deepest zoom tiles are cut at.
readElevations Func<RectangleShape, int, int, Single[]>
Answers a Web Mercator extent at width x height samples with row-major elevations in meters, NaN where the sampler has no answer.
Methods¶
OpenAsync(CancellationToken)¶
public Task OpenAsync(CancellationToken cancellationToken)
Parameters¶
cancellationToken CancellationToken
Returns¶
GetTileImageAsyncCore(int, long, long, CancellationToken)¶
protected Task<Byte[]> GetTileImageAsyncCore(int zoom, long x, long y, CancellationToken cancellationToken)
Parameters¶
zoom int
x long
y long
cancellationToken CancellationToken
Returns¶
Dispose(bool)¶
Releases the resources this source holds.
protected void Dispose(bool disposing)
Parameters¶
disposing bool
true when called from .
Returns¶
Events¶
DataChanged¶
Raised when the tiles this source serves have changed - by RasterTileSource.Refresh(RectangleShape) - with the ground they changed over, null for all of it. The map listens and asks again.
public event EventHandler<TileSourceDataChangedEventArgs> DataChanged;