Skip to content

ThinkGeo Raster Sampling Logic and Behavior Matrix

Last Updated: February 24, 2026
Validated Against: thinkgeosdk commit 0918c8b2f

1. v14 Preset Behaviors (v14.4.4 Summary)

In v14.4.4, raster sampling followed a mostly path-driven model.

v14 Preset (DrawingQuality) Vector/Text AA Optimized Drawing Path Normal Drawing Path
HighSpeed ON (default) SKFilterQuality.High SKFilterQuality.Low (bilinear)
Default ON (default) SKFilterQuality.High SKFilterQuality.Medium
Medium ON (default) SKFilterQuality.High SKFilterQuality.Medium
HighQuality ON (forced) SKFilterQuality.High SKFilterQuality.High

SKFilterQuality.High in v14 was adaptive in practice:

  1. Upsample: bicubic-style filtering (Mitchell family behavior).
  2. Downsample: engine-level optimization that could apply mip-like behavior.
  3. Many map-related render paths were effectively forced to high-quality filtering.

2. v15 DrawingQuality Presets (Current)

In current v15 code, DrawingQuality maps to RenderingOptions and only controls anti-aliasing flags.

Preset (DrawingQuality) Image AA Vector AA Text AA
Standard (recommended) OFF ON ON
HighSpeed OFF OFF OFF
Default (deprecated) OFF ON ON
Medium (deprecated) OFF ON ON
HighQuality (deprecated) OFF ON ON

Sampling is configured independently (Section 3) and is not controlled by DrawingQuality.


3. Current Resampling Architecture

The runtime is not a single pipeline. There are two entry paths.

3.1 Layer-Based Path (LayerBase)

Used by most async/online/tile/vector layer draw paths:

Layer RasterContentType
  -> LayerBase.GetRasterResamplingMode()
  -> RasterResamplingMode
  -> SkiaSamplingHelper.Resolve(...)
  -> SKSamplingOptions

LayerBase.GetRasterResamplingMode() mapping:

Layer RasterContentType Mode
CategoricalRaster NearestNeighbor
CartographicTiles CartographicAuto
Imagery / ContinuousRaster / Unspecified Auto

3.2 RasterSource-Based Path (RasterLayer)

RasterLayer draw flow uses imageSource.GetResolvedMode() instead of LayerBase.GetRasterResamplingMode().

For GeoTiffRasterSource and SkiaRasterSource:

  1. If ResamplingMode != Auto, use it directly.
  2. Else if GetRasterContentType() == CategoricalRaster, use NearestNeighbor.
  3. Else return Auto.

Important consequence:

  • In this path, cartographic content does not automatically switch to CartographicAuto; it remains Auto unless explicitly set.

3.3 WPF Raster Path (WpfRasterSource)

WpfRasterSource uses WPF BitmapScalingMode for resize operations:

  • Explicit ResamplingMode wins when set.
  • If Unspecified, default by content type:
  • CategoricalRaster / CartographicTiles -> NearestNeighbor
  • Imagery / ContinuousRaster -> Linear
  • Unspecified -> Unspecified

This path uses WPF scaling (RenderOptions.SetBitmapScalingMode) rather than Skia sampling options.

3.4 Skia Scale-Adaptive Rules

SkiaSamplingHelper.Resolve(...) behavior:

Mode Near Identity (0.95 <= scale <= 1.05) Upsample (>1.05) Downsample (<0.95)
Auto Mitchell Mitchell Linear + Mipmap
CartographicAuto Nearest Mitchell Linear + Mipmap
NearestNeighbor Nearest Nearest Nearest
Bilinear Bilinear Bilinear Bilinear
Trilinear Linear + Mipmap Linear + Mipmap Linear + Mipmap
Bicubic Mitchell Mitchell Mitchell

4. How Content Type Is Determined (Current Code)

4.1 Feature Layers

  • FeatureLayer: scans styles; if any HeatStyle exists -> ContinuousRaster; otherwise -> CartographicTiles.

4.2 Internet and Cloud Layers

Dynamic Imagery vs CartographicTiles by map/style type:

  • GoogleMapsAsyncLayer
  • BingMapsAsyncLayer
  • HereMapsRasterTileAsyncLayer
  • MapBoxStaticTilesAsyncLayer
  • ThinkGeoRasterMapsAsyncLayer
  • AzureMapsRasterAsyncLayer (also has weather tile sets mapped to ContinuousRaster)

Always cartographic:

  • OpenStreetMapAsyncLayer
  • ThinkGeoVectorMapsAsyncLayer

4.3 Protocol Layers

Default to CartographicTiles:

  • WmsAsyncLayer
  • WmtsAsyncLayer
  • ArcGisServerRestAsyncLayer
  • ArcGisServerRestVectorAsyncLayer
  • WfsV2AsyncLayer

4.4 Raster Sources

  • GeoTiffRasterSource, SkiaRasterSource, and WpfRasterSource currently do not override GetRasterContentTypeCore(), so default content type is Unspecified unless subclassed.
  • Their effective behavior therefore depends on explicit ResamplingMode and/or source-specific fallback logic.

5. Practical Override Patterns

5.1 Override Layer Content Type

public class MyFeatureLayer : ShapeFileFeatureLayer
{
    protected override RasterContentType GetRasterContentTypeCore()
        => RasterContentType.CartographicTiles;
}

5.2 Override Raster Source Content Type

public class MyGeoTiffSource : GeoTiffRasterSource
{
    public MyGeoTiffSource(string path) : base(path) { }

    protected override RasterContentType GetRasterContentTypeCore()
        => RasterContentType.CategoricalRaster;
}

5.3 Force an Explicit Resampling Mode

var layer = new GeoTiffRasterLayer("data.tif");
layer.ResamplingMode = RasterResamplingMode.CartographicAuto;

Use explicit mode when you need deterministic behavior independent of inferred content type.