Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Intro

ESA

There are multiple ways to interactivcely visualise COG files and their pyramids, a lot of which rely on some sort of http connection or local file server running. There are generally more ways to visaulisae data, so long as you are happy viewing it in web mercator.

No data transformation are required as building the pyramids and overviews is part of the cog specification.

We present three ways:

  • Using local tile server, which is a lightweight tile server that shows data locally

  • HV Plot to interactively plot. HV plot is popular and part of the pangeo package and good for small and high resoulition datasets

  • Open Layers. Open layers is a Javascript library to generate dynamic maps and works in multple projections and from many data sources cog, parquet, geozarr , etc.

Tile server quick view

HV plot - raw data plotting

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Total overview levels found: 4
Displaying overview_level=3
Displayed shape: 402 x 382
Loading...

OpenLayers COG viewer

For open layers you need to a remote file or to create an http server that allows cross origin requests using python for example, that will server the files. The javascript code should use the new open layers functionality, the correct crs and basemap.


     const cogSource = new ol.source.GeoTIFF({
      normalize: false,
      interpolate: true,
      sources: [{
        url: COG_URL,
        nodata: NODATA
      }]
    });

    const band = ["band", 1];
    const validData = [
      "all",
      ["==", band, band],
      [">", band, NODATA_THRESHOLD]
    ];

    const cogLayer = new ol.layer.WebGLTile({
      title: "Basal melt COG",
      source: cogSource,
      opacity: OPACITY,
      style: {
        color: [
          "case",
          validData,
          [
            "interpolate", ["linear"], band,
            MIN_VALUE, ["color", 49, 54, 149, 0.85],
            0, ["color", 255, 230, 0, 0.90],
            MAX_VALUE, ["color", 165, 0, 38, 0.90]
          ],
          ["color", 0, 0, 0, 0]
        ]
      }
    });

    const map = new ol.Map({
      target: "map",
      layers: [basemap, cogLayer],
      view: new ol.View({
        projection,
        center: [0, 0],
        zoom: 3,
        minZoom: 0,
        maxZoom: 8,
        extent: antarcticaExtent,
        resolutions: basemapResolutions
      }),
      controls: ol.control.defaults.defaults().extend([
        new ol.control.ScaleLine()
      ])
    });