The SketchViewModel Layer

1481
2
05-19-2018 09:56 AM
JustinCarasick
New Contributor III

The SketchViewModel seems to add an untitled layer to the map in addition to the graphics layer assigned to the layer property of the SketchViewModel.

I'm guessing the the untitled layer is for the "sketch" whereas the grapics layer assigned to the layer property of the SketchViewModel is for the result graphic from the sketch.

At any rate, the untitled layer shows up in the layerlist. is there anyway to get that hidden? 

in the attached image the "Measurement Graphics" is the graphics layer assigned to the layer property of the SketchViewModel.

Thanks

0 Kudos
2 Replies
JustinCarasick
New Contributor III

just adding my workaround to this thread. By hiding the private member for _defaultGraphicsLayer which is not ideal but works.

// create a new sketch view model
this.sketchViewModel = new this.esri.SketchViewModel({
view: this.view,
layer: this.selectionGrapicsLayerName,
polylineSymbol: this.polylineSymbol,
polygonSymbol: this.polygonSymbol
});

//shouldn't have to do this but adds and "untitled layer" to the layerlist
this.sketchViewModel._defaultGraphicsLayer.listMode = "hide";
0 Kudos