[go: up one dir, main page]

Skip to content

Resolve "Add AggregateImageSource to combine several image sources into one"

Summary

This MR introduces the AggregateImageSource, which, similarly to the AggregatePointCloudSource, combines several sources into one.

const source1 = new GeoTIFFSource({ url: 'http://example.com/image1.tif' });
const source2 = new GeoTIFFSource({ url: 'http://example.com/image2.tif' });

const aggregate = new AggregateImageSource({ sources: [source1, source2] });

Features

  • Supports ordering sources by z-index (the index of the source in the array is the z-index)
  • Can mix any type of sub-source (geotiff, vector, wmts, etc), as long as they have the same image parameters (see below)
  • All sub-sources must have the same CRS

Advantages

By combining sources into a single source, we avoid the need to create multiple layers. This is useful for the following reasons:

  • Workaround the limitation of a single elevation layer per Map
  • Workaround the limitation of a single color layer per point cloud
  • Massively reduce the memory footprint of layers (no need to create additional render textures)
  • Reduce the CPU footprint of layers

Inconvenients

Using sources rather than layers gives less control over the images:

  • cannot change the opacity of individual sources
  • cannot assign different colormap to individual sources
  • all sources must share the same parameters, such as flip-y, datatype (cannot mix 8-bit and 32-bit images), color space
  • all sources must have the same CRS (though we might want to support per-source reprojection later)

Use cases

Possible use cases include:

  • Stacking WMS/WMTS/vector layers into a single layer, useful to compose a full image from thematic layers (orthophoto, roads, administrative subdivisions...)
  • Combine a low-resolution elevation source, such as ETOPO, SRTM, GEBCO, and high-resolution local elevation sources, such as GeoTIFFs
  • Compose a mosaic of images, such as a mosaic of SRTM tiles (a bit like the now-deleted CustomTiledImageProvider, but much more flexible, since it can support any kind of sub-source)
  • Mimic a GDAL VRT file

TODO

  • Upload datasets to 3d.oslandia.com
  • Improve description of example
  • Add stacked WMTS layers example
  • Add SRTM mosaic example
  • Add stacked elevation sources (low-res + high-res) example
  • Add documentation to AggregateImageSource
  • Expose AggregateImageSource to API documentation
  • Add basic tests for AggregateImageSource
  • Support stacking transparent sources (e.g WMTS layers)
  • Handle abort errors in requests

Closes #581 (closed)

Edited by Sébastien Guimmara

Merge request reports

Loading