Skip to content

COG area displayed, but COG itself appears to not be shown #89

@TheTiGuR

Description

@TheTiGuR

I am trying to display a COG as an overlay on my map, and the layer itself exists, but the image is not actually displayed. Zooming in and out shows calls being made to grab the data at particular points, but nothing ever displays.

To Reproduce
I presume I am missing something simple, but my basic code that I have tried variations of messing around with:

      parseGeoraster(cogPath).then(async (georaster) => {
        const tiff = georaster._geotiff;
        const img = await tiff.getImage();
        console.log(img.getGDALMetadata());
        console.log(
          georaster,
          georaster.mins,
          georaster.maxs,
          georaster.ranges,
        ); // This shows the georaster and 3 undefined values
        const layer = new GeoRasterLayer({
          georaster: georaster,
          opacity: 1,
          pixelValuesToColorFn: (values) => {
            if (values[0] === 42) {
              console.log(values);
            } // This never logs a value, but without it the area where the COG would be shows nothing
            return values[0] === 42 ? '#ffffff' : '#00F';
          },
          resolution: 32,
        });
        layer.addTo(this.map);
        this.map.fitBounds(layer.getBounds());
      });

image

Current environment:
MacOS 14.4.1, Chrome Latest, Apple MBP M3

The actual COG loads fine in QGIS fine, for what its worth.
I can't provide a sample of the whole code, but the maps otherwise work fine, just this integration of the COGs into it is having a problem. Thanks for any suggestions.

Edit:
Noting that the rectangle drawn (red line) comes from other layers drawn

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions