when i try draw graphic using widget skitch while i get webmap by portal id the graphic not show

283
1
04-11-2021 02:18 AM
mahmoudrefaat
New Contributor

here in version 4.18 last version the skitch not work correctly when i get webmap from portal id that is my problem .

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<title>Sketch widget | Sample | ArcGIS API for JavaScript 4.18</title>

<link
rel="stylesheet"
href="https://js.arcgis.com/4.18/esri/themes/light/main.css"
/>
<script src="https://js.arcgis.com/4.18/"></script>

<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
require([
"esri/widgets/Sketch",
"esri/Map",
"esri/layers/GraphicsLayer",
"esri/views/MapView",
"esri/WebMap",
"esri/config"
], function (Sketch, Map, GraphicsLayer, MapView, WebMap, esriConfig) {
const layer = new GraphicsLayer();


var webmap = new WebMap({
portalItem: { id: "2e5f696b97e7424fb5d6ffe001da36b0" }
});
const view = new MapView({ map: webmap, container: "viewDiv" });

const sketch = new Sketch({
layer: layer,
view: view,
// graphic will be selected as soon as it is created
creationMode: "update"
});

view.ui.add(sketch, "top-right");
});
</script>
</head>

<body>
<div id="viewDiv"></div>
</body>
</html>

 

 

0 Kudos
1 Reply
AndyGup
Esri Regular Contributor

There was a known issue that's been fixed for the 4.19 release, which will be available in a few weeks.

Trying testing again by substituting https://js.arcgis.com/4.18 for https://js.arcgis.com/next

Reference: https://github.com/Esri/feedback-js-api-next#arcgis-api-for-javascript---next

0 Kudos