| Bug ID Number |
BUG-000123451 |
| Submitted | July 1, 2019 |
| Last Modified | June 5, 2024 |
| Applies to | ArcGIS API for JavaScript |
| Version found | 4.12 |
| Status | Non-Reproducible
This issue was not reproducible when tested by the development team. Issues may be given this status when they cannot be reproduced or are no longer relevant in a development version of the software, but a specific fix was not installed to address the issue. The issue's Additional Information section may contain further explanation.
|
Additional Information
GraphicsLayer is added before the view is ready. Update the code to the following and it works correctly:
var layer = new GraphicsLayer();
const map = new WebMap({ portalItem: { id: '3acfce904368451f82b60d5c8a120f82' }});
const view = new MapView({
container: "viewDiv",
map: map,
zoom: 5,
center: [-74, 45]
});
view.when(function(evt) {
map.add(layer);
var sketch = new Sketch({
layer: layer,
view: view
});
view.ui.add(sketch, "top-right");
})
Workaround
Repeat the above steps with this jsbin: https://jsbin.com/tatatedece/edit?html,output
The workaround is to add the image service directly to the map versus adding in the web map and consuming it via ArcGIS API for JavaScript.
Steps to Reproduce