AnsweredAssumed Answered

LayerList 4.x hide layer

Question asked by sky12james on Mar 13, 2017
Latest reply on Apr 20, 2017 by JimNoel

I added GraphicLayer to the LayerList Widget sameple and get "Untitled layer."  I wonder is there a ways to hide "Untitled layer" or hide MapImageLayer.    See code below.

 

<!DOCTYPE html>
<html>
<head>

<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>LayerList widget - 4.3</title>

<link rel="stylesheet" href="https://js.arcgis.com/4.3/esri/css/main.css">

<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
overflow: hidden;
}
</style>

<script src="https://js.arcgis.com/4.3/"></script>

<script>
require([
"esri/views/SceneView", "esri/layers/GraphicsLayer",
"esri/widgets/LayerList",
"esri/WebScene",

"dojo/domReady!"
], function(
SceneView, GraphicsLayer, LayerList, WebScene
) {

var scene = new WebScene({
portalItem: { // autocasts as new PortalItem()
id: "66adfe99eeaf40fc82ad1e94751cff0b"
}
});

var view = new SceneView({
container: "viewDiv",
map: scene
});

var parcelGL;
parcelGL = new GraphicsLayer();
scene.add(parcelGL);

view.then(function() {
var layerList = new LayerList({
view: view
});

// Add widget to the top right corner of the view
view.ui.add(layerList, "top-right");
});
});
</script>

</head>

Thank you.

Outcomes