|
POST
|
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 more
11-06-2020
02:51 AM
|
1
|
1
|
2257
|
|
POST
|
Hi Ryan, It's because you haven't assigned an initial renderer to your layer. // create initial renderer
let layerRenderer = new RasterStretchRenderer({
colorRamp: colorRamp,
stretchType: stretchType
});
// create a ImageryTileLayer from tiled elevation service
const layer = new ImageryTileLayer({
url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Elevation/MtBaldy_Elevation/ImageServer",
opacity: 0.9,
renderer: layerRenderer
}); Without it, there's nothing to clone in your updateRenderer function.
... View more
11-05-2020
07:04 AM
|
1
|
0
|
3524
|
|
POST
|
I've found the answer on the updated page for popupTemplate let popupTemplate = {
title: '',
fieldInfos: [{
fieldName: 'Raster.ItemPixelValue',
format: {
places: 0, // precision
digitSeparator: true // thousands comma separator
}
}]
};
... View more
08-26-2020
01:44 AM
|
1
|
0
|
1593
|
|
POST
|
Hello, I have an 32 bit Float single-band ImageryLayer with a popupTemplate assigned. The popup shows the raster service pixel value with the following code: const variableLayer = new ImageryLayer({
url: 'https://this_is_a_fake_url/ImageServer',
popupTemplate: {
title: '{Raster.ServicePixelValue} variable count(s) in {Year}'
content: [],
},
}); Is there a way to round the service pixel value which is displayed in the popup? Note: I do not want to round the raster data pixels themselves. I've tried something like this: const variableLayer = new ImageryLayer({
url: 'https://this_is_a_fake_url/ImageServer',
popupTemplate: {
//title: '{Raster.ServicePixelValue} variable count(s) in {Year}'
content: '{expression/pixelvalue} variable count(s) in {Year}',
expressionInfos: [{
name: 'pixelvalue',
expression: 'Round($Raster.ServicePixelValue, 2)'
}]
},
}); Any combination of experimenting that I've tried has resulted in either undefined or null in the place where the pixel value should be displayed in the popup. Any help is massively appreciated! Thank you for reading.
... View more
08-06-2020
02:14 AM
|
0
|
1
|
1661
|
|
POST
|
Hi all, I'm wondering if this is even possible. All instructions (like this one) I can find about using the Histogram Widget use a vector layer. I'm using a single band Image Service built from a multi-dimensional mosaic dataset and a TimeSlider. Can anyone point me to an existing tutorial or example which uses a raster? I'd appreciate any advice! Cheers, Gianna
... View more
08-04-2020
05:36 AM
|
0
|
1
|
1123
|
|
POST
|
Hi Jared, What you can do is add a checkbox in your HTML: <label id="isResLabel">
<input id="isResInput" type="checkbox" checked="yes" />
<span class="isResToggle"></span>
</label> and then add a listener function which changes the definition expression on the layer: // click event handler for res choice
view.when(function() {
document
.getElementById('isResInput')
.addEventListener('change', updateIsRes);
});
function updateIsRes(event) {
if (this.checked) {
recycleLayer.definitionExpression = "USER_IsRes = 'TRUE'"
} else {
recycleLayer.definitionExpression = "USER_IsRes = 'FALSE'"
}
}; I'd suggest you have one checkbox for residential and one for business and the user can toggle to their hearts delight: Hope this helps. Cheers, Gianna
... View more
07-01-2020
08:16 AM
|
1
|
0
|
1567
|
|
POST
|
Hi Joe, As a developer, I use Esri Color Ramps | ArcGIS API for JavaScript 4.15 all the time. I find it useful for desktop applications too. Cheers, Gianna
... View more
07-01-2020
07:08 AM
|
2
|
1
|
1700
|
|
POST
|
Hi Rudy, view.zoom only logs the current zoom level on mouse-wheel (i.e. the zoom level BEFORE the mouse-wheel action). There is a way to log the current zoom level of the view with watchUtils. watchUtils.watch(view, "zoom", function(zoom) {
console.log(zoom);
}; Don't forget to add the require at the beginning of your script require(["esri/core/watchUtils"], function(watchUtils) { /* code goes here */ });
... View more
06-05-2020
06:51 AM
|
1
|
0
|
919
|
|
POST
|
Hi Richie, That's the ticket! Thank you so much for your help. I'm massively grateful. Cheers, Gianna
... View more
04-07-2020
02:45 AM
|
1
|
0
|
3020
|
|
POST
|
Hi Richie, Thanks for the reply. Seeing as this might be the only way forward, I've built a custom slider to deal with my unconventional dates. However, I have a problem when trying to animate the slider. I'm trying to replicate the two examples available (Animate color visual variables and Animate opacity visual variable) but havent quite gotten it yet. Here's a codepen with my work so far. (just a note that codepen does something funky with my layout and elements - so it's not exactly what it gonna look like) (also another note that I have another slider which chooses scenarios which I do not want to animate) Can you help me hooking up the playButton with yearSlider?
... View more
04-06-2020
04:29 AM
|
0
|
1
|
3020
|
|
POST
|
Hi everybody, I've been working on displaying a multi-dimensional mosaic dataset in a web app with js (which wouldn't have been possible without this forum so far: thank you). I'm nearly done with everything, but there's one lingering problem: My dataset intends to show scenarios in five year increments starting at +5 years and going to +100 years (in the future starting from when the user is looking at the data [or intends to implement said scenario]). Currently, the date field is set in years and I have added 2000 to each of the scenarios so that TimeSlider would work. So my date slider looks like: After changing a few things in the CSS, namely: #timeSlider {
position: absolute;
width: 33%;
left: 33%;
}
.esri-time-slider__time-extent,
.esri-time-slider__min,
.esri-time-slider__max,
.esri-slider__tick.minorTick {
display: none !important;
}
It looks like this: Just in case, here's the JS used to create TimeSlider: // create and add time slider to view
const timeSlider = new TimeSlider({
container: 'timeSlider',
mode: 'instant',
view: view
});
view.ui.add(timeSlider, 'manual');
// wait until the layer view is loaded
let timeLayerView;
view.whenLayerView(layer).then(function(layerView) {
timeLayerView = layerView;
const fullTimeExtent = layer.timeInfo.fullTimeExtent;
const start = fullTimeExtent.start;
// set up time slider properties
timeSlider.fullTimeExtent = fullTimeExtent;
timeSlider.values = [start];
timeSlider.stops = {
interval: layer.timeInfo.interval
};
}); What I would like is an *animated* slider with labels in 5 year increments starting at 5 and ending at 100. ------------------------------------------------------------------------------------------------------------------------------------------------------- So the way I see, there would be three ways to 'solve' this problem: Somehow hack time-enabled layers and TimeSlider JS to accept values less than 100 as temporal Allow TimeSlider to configure user-defined labels Use CSS to define labels Are any of these even possible?
... View more
03-31-2020
02:02 AM
|
0
|
4
|
3154
|
|
POST
|
Hi Anne, That's it! I was missing the point that it was an array. I'll have to speak with our DB manager about the layer not loading, but thank you soo much for helping me with this one. It's been a struggle. All the best, Gianna
... View more
03-27-2020
01:28 AM
|
1
|
0
|
4207
|
|
POST
|
Hi Anne, I'm sorry my layer isn't loading - how frustrating. You may be able to see it if you go to Woodland Expansion. Please let me know if you do. I feel as if I'm getting closer to solving my problem, though I'm still missing something. I tried adding a function to update the multidimensionalDefinition of my mosaicRule but there's still a disconnect somewhere. I feel daft... I updated my jsfiddle slider.on(['thumb-change', 'thumb-drag'], function(event) {
updateDimDef(event.value);
});
function updateDimDef(value) {
const mosaicRuleClone = mosaicRule.clone(); // makes clone of mosaicRule
mosaicRuleClone.multidimensionalDefinition.values = [(value)]; // redefines multiDim value to slider value?
layer.mosaicRule = mosaicRuleClone; // assigns mosaicRule to layer again
}; Thanks again for your help. Truly grateful!
... View more
03-26-2020
09:28 AM
|
0
|
2
|
4207
|
|
POST
|
Hi Anne, Thanks for that. Cool to see that something is happening. It does print the slider value to the console when I thumb-change/thumb-drag. So now how do I make the data change when I change the slider? Thanks for your help!
... View more
03-24-2020
09:27 AM
|
0
|
4
|
4206
|
|
POST
|
Hi everyone, I'm a bit of noob at this js stuff. I have a multi-dimensional mosaic dataset (netCDFs) with two dimensions: year and fma. year spans from 2005 to 2100 fma spans 1 to 11 (these correspond to different scenarios) What I would like to learn how to do is to make the Slider (aka rangeSlider) listen and change the data displayed when a user changes the slider value on the right (1-11). See my jsfiddle here Any help is massively appreciated.
... View more
03-24-2020
04:36 AM
|
0
|
6
|
4430
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-26-2020 01:44 AM | |
| 1 | 01-29-2021 05:09 AM | |
| 1 | 11-16-2020 03:46 AM | |
| 1 | 11-05-2020 07:04 AM | |
| 1 | 11-06-2020 02:51 AM |
| Online Status |
Offline
|
| Date Last Visited |
08-09-2022
08:05 AM
|