Select to view content in your preferred language

Use imageService Identify to get pixel values from all layers of a multidimensional raster

656
1
Jump to solution
01-05-2023 06:45 AM
MichaelinMaps
New Contributor

I'm working with a multidimensional CRF raster being pulled from an image server REST endpoint. I would like to allow users to click on the raster and have the computer return all the pixel values, in chronological order, for that certain spot. Ideally I'll then allow them to export these values but at this point I'd just like to get the values to log in the console so I know I'm correctly grabbing them. 

my current code for the identification looks like this:

view.on("click", (event) => {
  layer.identify(url, {
  geometry: event.mapPoint,
  mosaicRule: {
     ascending: true,
   },
  processAsMultidimensional: true,
  returnPixelValues: true,
  returnCatalogItems: false,
  returnGeometry: false,
  timeExtent: {
    start: dates[0],
    end: dates[dates.length - 1]
  },
})
.then((results) => {
  alert("values: ", results.value)
})
  .catch((err) => console.log(err));
});

 

The console throws back an error:

MichaelinMaps_1-1672929627462.png

I'm not sure what I am doing wrong here.

Any help is much appreciated! If anyone has any examples of how they have used imageService Identify in the past I'd also be very apprciative, as I'm new to this and examples work wonders on my understanding of things.

 

Thanks!

 

0 Kudos
1 Solution

Accepted Solutions
MichaelinMaps
New Contributor

I solved it. I just had to remove the url from the arguments. I guess because I was already performing the method on an image service layer the url was redundant. I also changed the alert to a console.log.

View solution in original post

0 Kudos
1 Reply
MichaelinMaps
New Contributor

I solved it. I just had to remove the url from the arguments. I guess because I was already performing the method on an image service layer the url was redundant. I also changed the alert to a console.log.

0 Kudos