Programmatically Access Rasters from Mosaic Dataset Image Service using Javascript API

1195
3
Jump to solution
10-30-2020 11:26 AM
tigerwoulds
Occasional Contributor III

Let me preface this with the fact that I am not a GIS Developer, more of a GIS Analyst with minimal programming experience. I have around 150 rasters to publish that will be used in a web map.  Running Federated ArcGIS Enterprise 107 and Image Server 107. 

I am trying to publish these rasters so they work with an existing web map using arcgis jsapi 4.

Rather than publishing 150 individual services, I have published a mosaic dataset as a single service to my Image Server. How can I access each raster programmatically?

In ArcCatalog I can query/select rasters in a mosaic dataset by it's Name - trying to replicate this in the js api.

Are there any examples out there? I would like to access individual rasters using a unique url. 

Thanks!

0 Kudos
1 Solution

Accepted Solutions
Gianna_BBSRC
Occasional Contributor

Hi there, 

I've long struggled through this exact question. You can access each raster programmatically. 

Have a look at this website which I created to select from 440 different rasters using two sliders (woodland planting scenario on the left and 'time from present' at the bottom) and a checkbox (selects different rasters with or without areas with deep peat soils).

Put very simply, it's done by changing the DimensionalDefinition within MosaicRule for each selection. 

You can have a look at the script on github. Any specific questions, I'm happy to help. 

Cheers,

Gianna

View solution in original post

3 Replies
Gianna_BBSRC
Occasional Contributor

Hi there, 

I've long struggled through this exact question. You can access each raster programmatically. 

Have a look at this website which I created to select from 440 different rasters using two sliders (woodland planting scenario on the left and 'time from present' at the bottom) and a checkbox (selects different rasters with or without areas with deep peat soils).

Put very simply, it's done by changing the DimensionalDefinition within MosaicRule for each selection. 

You can have a look at the script on github. Any specific questions, I'm happy to help. 

Cheers,

Gianna

tigerwoulds
Occasional Contributor III

Thanks so much! Your web map is really impressive. I think I have what I need to figure it out from here. 

0 Kudos
JohnGrayson
Esri Regular Contributor

Depending on the how the ImageryLayer was published, there could be several different ways to only display certain information.  For your use-case, setting the definitionExpression based on the Name field should be one way.  When trying to override the default settings as published by the service author, I normally clear/reset the definitionExpression and mosaicRule properties as soon as the layer is loaded, and then set these properties as needed based on the task at hand.