Creating markers from raster pixel values at Openlayers

116 views Asked by At

I am creating a raster from XYZ layer using this code with latest version of Openlayers:

const source = new XYZ({
  url: "https://gibs-{a-c}.earthdata.nasa.gov/wmts/epsg4326/best/" +
    "GHRSST_L4_AVHRR-OI_Sea_Surface_Temperature/default/2020-04-02/" +
    "2km/{z}/{y}/{x}.png",
  crossOrigin: "",
});


const raster = new RasterSource({
  sources: [source],
  operation: function (pixels, data) {
    var pixel = pixels[0]; 
    if (pixel[0] === 45 && pixel[1] === 0 && pixel[2] === 28) {

      pixel[0] = 255;
      pixel[1] = 255;
      pixel[2] = 0;
    }

    return pixel;
  }
});

Changing a specific pixel color to yellow color. What I would like to do is, placing markers on these specific pixel values. If you look at the image, I would like to place markers (little circles maybe) at center of these yellow pixels. I couldn't get coordinates of these pixels even.

Can you please help me?

enter image description here

0

There are 0 answers