AnsweredAssumed Answered

Issue with my code

Question asked by shakyasingh on Jul 9, 2019
Latest reply on Jul 12, 2019 by rscheitlin

I am using esri arcgis javascript 4.11 ,all the other things is walking but the LEGEND could not be added to the mapview this is the error "Export There seems to have been an error." is showing  and all the layers are being added by clicking on checkbox.

 

<script src="https://js.arcgis.com/4.11/"></script>
<script>
let view;
require([
"esri/Map",
"esri/views/MapView",
"esri/WebMap",
"esri/widgets/ScaleBar",
"esri/widgets/BasemapToggle",
"esri/widgets/BasemapGallery",
"esri/layers/FeatureLayer",
"esri/PopupTemplate",
"esri/widgets/Zoom",
"esri/tasks/QueryTask",
"esri/tasks/support/Query",
"esri/Graphic",
"esri/geometry/Geometry",
"esri/core/Accessor",
"esri/geometry/Extent",
"esri/symbols/SimpleLineSymbol",
"esri/layers/SceneLayer",
"esri/views/draw/Draw",
"esri/geometry/geometryEngine",
"esri/views/draw/PolygonDrawAction",
"esri/layers/support/Sublayer",
"esri/layers/ImageryLayer",
"esri/layers/MapImageLayer",
"esri/renderers/UniqueValueRenderer",
"esri/Viewpoint",
"esri/widgets/Legend",
"esri/widgets/Print",
"esri/widgets/Directions"

], function(Map, MapView,WebMap,ScaleBar,BasemapToggle,BasemapGallery,FeatureLayer,InfoTemplate,PopupTemplate,Zoom,QueryTask,Query,Graphic,Geometry,
Accessor,Extent,SimpleLineSymbol,SceneLayer,Draw,geometryEngine,PolygonDrawAction,Sublayer,ImageryLayer,MapImageLayer,
UniqueValueRenderer,Viewpoint,Legend,Print,Directions) {


var map = new Map({
basemap: "topo"
});


view = new MapView({
container: "viewDiv",
map: map,
center: [85.0985,20.5]
zoom: 8
});

var scaleBar = new ScaleBar({
view: view,
unit: "dual"
});
view.ui.add(scaleBar, {
position: "bottom-left"
});


view.when(function() {

var featureLayer = map.layers.getItemAt(0);
var legend = new Legend({
view: view,
layerInfos: [
{
layer: featureLayer,
title: "test"
}
]
});
view.ui.add(legend, "bottom-right");
});


var roadsLayer = new FeatureLayer("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", {
id : "roadLayerId",
outFields: ["*"],
popupTemplate: {
title: "NAME1 : {XXXXXXXX}:NAME: {XXXK}",
content: "TESTED"
}
});

$("#chkRoadLayer").click(function () {
if(!roadsLayer){
}else {
}
if ($(this).is(":checked")) {
map.add(roadsLayer,1);

} else {
map.layers.remove(roadsLayer);
}
});


//XXXXXXXXXXXXXXXXXXXXXXXXXXXX
//XXXXXXXXXXXXXXXXXXXXXXXXXXXX
//XXXXXXXXXXXXXXXXXXXXXXXXXXXX
//XXXXXXXXXXXXXXXXXXXXXXXXXXXX
//XXXXXXXXXXXXXXXXXXXXXXXXXXXX
//#other codes goes here

});

</script>

 

Robert Scheitlin, GISP

Attachments

Outcomes