Hey everyone, I am currently pulling the FeatureLayer by its name and applying ElevationInfo onto it.
map3D.when(function(){
// Retrieve FeatureLayer from WebScene
var featureLayer3D = map3D.layers.find(function(layer){
return layer.title === "Env 09092018";
});
// Define elevationInfo and set it on the layer
var currentElevationInfo = {
mode: "absolute-height",
offset: -20,
unit: "meters"
};
featureLayer3D.elevationInfo = currentElevationInfo;
});
I was wondering is there a way to retrieve by calling the first FeatureLayer as opposed to calling by the name(Env 09092018) itself? Thanks in advance!
Solved! Go to Solution.
James,
Just use getItemAt(0).
https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#getItemAt
map3D.when(function(){
// Retrieve FeatureLayer from WebScene
var featureLayer3D = map3D.layers.getItemAt(0);
// Define elevationInfo and set it on the layer
var currentElevationInfo = {
mode: "absolute-height",
offset: -20,
unit: "meters"
};
featureLayer3D.elevationInfo = currentElevationInfo;
});
James,
Just use getItemAt(0).
https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#getItemAt
map3D.when(function(){
// Retrieve FeatureLayer from WebScene
var featureLayer3D = map3D.layers.getItemAt(0);
// Define elevationInfo and set it on the layer
var currentElevationInfo = {
mode: "absolute-height",
offset: -20,
unit: "meters"
};
featureLayer3D.elevationInfo = currentElevationInfo;
});
How can I have not thought of that, got it to work! Thanks so much for your help Robert!