<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Editor Widget -  Sannping Layers are not loaded in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-sannping-layers-are-not-loaded/m-p/1238696#M79589</link>
    <description>&lt;P&gt;Hi ExB community,&lt;BR /&gt;I am using version 4.24.&lt;/P&gt;&lt;P&gt;1- I am using MapImageLayer and FeatureLayer layers in my project at the same time.&lt;BR /&gt;When I set the ListMode value to 'hide', layers are not loaded in SanappingLayer.&lt;BR /&gt;I don't want layers to be displayed in LayerList but SnappingLayer is active.&lt;BR /&gt;&lt;BR /&gt;2- Is the simultaneous use of MapImageLayer and FetureLayer layers in the project&lt;BR /&gt;Is it the right thing to do?&lt;BR /&gt;What should I do to not override the layer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; var strProxyUrl = "../../ProxyConfig/proxy.ashx";
    strUrl = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/MapServer";
    strUrl2 = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/FeatureServer";
    function rdBtnList_onchange() {

        if (document.getElementById('rdBtnList_1').checked) {
            strUrl = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/FarsProvince_SwereTransDistributionMap/MapServer";
            strUrl2 = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/FarsProvince_SwereTransDistributionMap/FeatureServer";
        }
        else if (document.getElementById('rdBtnList_2').checked) {
            strUrl = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/MapServer";
            strUrl2 = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/FeatureServer";
        }
        InitMap();
        return false;
    }

    var identifyTask;
    var params;
    var arrMapLayers = [];
    var objFeatureLayer = null;
    var view = null;
    function InitMap() {
        require([
             "esri/Map",
            "esri/WebMap",
            "esri/views/MapView",
            "esri/widgets/Editor",
            "esri/layers/MapImageLayer",
            "esri/request",
            "esri/layers/FeatureLayer",
            "esri/config", "esri/request", "esri/widgets/LayerList"
        ],
        function (Map, WebMap, MapView, Editor, MapImageLayer, esriRequest, FeatureLayer, esriConfig, esriRequest, LayerList) {
            esriConfig.request.proxyUrl = strProxyUrl;

            if (document.getElementById('rdBtnList_0').checked) {

                esriConfig.request.proxyUrl = strProxyUrl;
                const webmap = new WebMap({
                    portalItem: {
                        id: "459a495fc16d4d4caa35e92e895694c8"
                    }
                });

                var view = new MapView({
                    container: "viewDiv",
                    map: webmap
                });

            } else {

                var objMapImageLayer = new MapImageLayer({
                    url: strUrl,
                    proxyUrl: strProxyUrl
                });
                objmap = new Map();
                objmap.add(objMapImageLayer);
                view = new MapView({
                    container: "viewDiv",
                    map: objmap
                });
            }
            let layerList = new LayerList({
                view: view
            });
            view.ui.add(layerList, {
                position: "top-left"
            });
            view.when(function () {
                DoEsriRequest_GetMapLayers(esriRequest, Editor, view);
                DoEsriRequest_GetFeatureLayers(esriRequest, FeatureLayer);

            }).catch(function (err) {
                console.error("objMapView rejected:", err);
            });

        });
    }
    function DoEsriRequest_GetMapLayers(esriRequest, Editor, view) {
        var options = {
            query: {
                f: "json"
            },
            responseType: "json"
        };
        esriRequest(strUrl + "/legend", options).then(function (response) {
            if (response == null)
                return;

            if (response.data == null)
                return;

            let responseJSON = JSON.stringify(response, null, 2);
            let arrResponseJSON = JSON.parse(responseJSON);

            for (let i = arrResponseJSON.data.layers.length - 1; i &amp;gt;= 0; i--) {
                arrMapLayers.push(arrResponseJSON.data.layers[i]);
            }
            Make_Editor(Editor, view);
        });
    }

    function Make_Editor(Editor, view) {
        const editor = new Editor({
            view: view,
            snappingControlsElements: {
                featureEnabledToggle: false, // removes "Feature to feature" toggle
                layerList: false // removes Snapping layers list
            }
        });
        view.ui.add(editor, "top-right");
    }
    function DoEsriRequest_GetFeatureLayers(esriRequest, FeatureLayer) {
        var options = {
            query: {
                f: "json"
            },
            responseType: "json"
        };
        var strUrlFeature = strUrl.replace('MapServer', 'FeatureServer');

        esriRequest(strUrlFeature, options).then(function (response) {
            try {

                if (response == null)
                    return;

                if (response.data == null)
                    return;

                let responseJSON = JSON.stringify(response, null, 2);
                let arrResponseJSON = JSON.parse(responseJSON);

                for (let i = arrResponseJSON.data.layers.length - 1; i &amp;gt;= 0; i--) {
                    var objFeatureLayer = new FeatureLayer({
                        url: strUrlFeature + "/" + arrResponseJSON.data.layers[i].id,
                        listMode: 'show',
                        editingEnabled: true,
                        labelsVisible: false,
                        hasM: true,
                        gdbVersion: 'DEFAULT',
                        title: arrResponseJSON.data.layers[i].name,
                        opacity: 1
                    });

                    objmap.add(objFeatureLayer);
                }

            } catch (e) {

            }
        });
    }
    InitMap();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2022 13:22:05 GMT</pubDate>
    <dc:creator>mohammaddmohammadii</dc:creator>
    <dc:date>2022-12-07T13:22:05Z</dc:date>
    <item>
      <title>Editor Widget -  Sannping Layers are not loaded</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-sannping-layers-are-not-loaded/m-p/1238696#M79589</link>
      <description>&lt;P&gt;Hi ExB community,&lt;BR /&gt;I am using version 4.24.&lt;/P&gt;&lt;P&gt;1- I am using MapImageLayer and FeatureLayer layers in my project at the same time.&lt;BR /&gt;When I set the ListMode value to 'hide', layers are not loaded in SanappingLayer.&lt;BR /&gt;I don't want layers to be displayed in LayerList but SnappingLayer is active.&lt;BR /&gt;&lt;BR /&gt;2- Is the simultaneous use of MapImageLayer and FetureLayer layers in the project&lt;BR /&gt;Is it the right thing to do?&lt;BR /&gt;What should I do to not override the layer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; var strProxyUrl = "../../ProxyConfig/proxy.ashx";
    strUrl = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/MapServer";
    strUrl2 = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/FeatureServer";
    function rdBtnList_onchange() {

        if (document.getElementById('rdBtnList_1').checked) {
            strUrl = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/FarsProvince_SwereTransDistributionMap/MapServer";
            strUrl2 = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/FarsProvince_SwereTransDistributionMap/FeatureServer";
        }
        else if (document.getElementById('rdBtnList_2').checked) {
            strUrl = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/MapServer";
            strUrl2 = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/FeatureServer";
        }
        InitMap();
        return false;
    }

    var identifyTask;
    var params;
    var arrMapLayers = [];
    var objFeatureLayer = null;
    var view = null;
    function InitMap() {
        require([
             "esri/Map",
            "esri/WebMap",
            "esri/views/MapView",
            "esri/widgets/Editor",
            "esri/layers/MapImageLayer",
            "esri/request",
            "esri/layers/FeatureLayer",
            "esri/config", "esri/request", "esri/widgets/LayerList"
        ],
        function (Map, WebMap, MapView, Editor, MapImageLayer, esriRequest, FeatureLayer, esriConfig, esriRequest, LayerList) {
            esriConfig.request.proxyUrl = strProxyUrl;

            if (document.getElementById('rdBtnList_0').checked) {

                esriConfig.request.proxyUrl = strProxyUrl;
                const webmap = new WebMap({
                    portalItem: {
                        id: "459a495fc16d4d4caa35e92e895694c8"
                    }
                });

                var view = new MapView({
                    container: "viewDiv",
                    map: webmap
                });

            } else {

                var objMapImageLayer = new MapImageLayer({
                    url: strUrl,
                    proxyUrl: strProxyUrl
                });
                objmap = new Map();
                objmap.add(objMapImageLayer);
                view = new MapView({
                    container: "viewDiv",
                    map: objmap
                });
            }
            let layerList = new LayerList({
                view: view
            });
            view.ui.add(layerList, {
                position: "top-left"
            });
            view.when(function () {
                DoEsriRequest_GetMapLayers(esriRequest, Editor, view);
                DoEsriRequest_GetFeatureLayers(esriRequest, FeatureLayer);

            }).catch(function (err) {
                console.error("objMapView rejected:", err);
            });

        });
    }
    function DoEsriRequest_GetMapLayers(esriRequest, Editor, view) {
        var options = {
            query: {
                f: "json"
            },
            responseType: "json"
        };
        esriRequest(strUrl + "/legend", options).then(function (response) {
            if (response == null)
                return;

            if (response.data == null)
                return;

            let responseJSON = JSON.stringify(response, null, 2);
            let arrResponseJSON = JSON.parse(responseJSON);

            for (let i = arrResponseJSON.data.layers.length - 1; i &amp;gt;= 0; i--) {
                arrMapLayers.push(arrResponseJSON.data.layers[i]);
            }
            Make_Editor(Editor, view);
        });
    }

    function Make_Editor(Editor, view) {
        const editor = new Editor({
            view: view,
            snappingControlsElements: {
                featureEnabledToggle: false, // removes "Feature to feature" toggle
                layerList: false // removes Snapping layers list
            }
        });
        view.ui.add(editor, "top-right");
    }
    function DoEsriRequest_GetFeatureLayers(esriRequest, FeatureLayer) {
        var options = {
            query: {
                f: "json"
            },
            responseType: "json"
        };
        var strUrlFeature = strUrl.replace('MapServer', 'FeatureServer');

        esriRequest(strUrlFeature, options).then(function (response) {
            try {

                if (response == null)
                    return;

                if (response.data == null)
                    return;

                let responseJSON = JSON.stringify(response, null, 2);
                let arrResponseJSON = JSON.parse(responseJSON);

                for (let i = arrResponseJSON.data.layers.length - 1; i &amp;gt;= 0; i--) {
                    var objFeatureLayer = new FeatureLayer({
                        url: strUrlFeature + "/" + arrResponseJSON.data.layers[i].id,
                        listMode: 'show',
                        editingEnabled: true,
                        labelsVisible: false,
                        hasM: true,
                        gdbVersion: 'DEFAULT',
                        title: arrResponseJSON.data.layers[i].name,
                        opacity: 1
                    });

                    objmap.add(objFeatureLayer);
                }

            } catch (e) {

            }
        });
    }
    InitMap();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 13:22:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-sannping-layers-are-not-loaded/m-p/1238696#M79589</guid>
      <dc:creator>mohammaddmohammadii</dc:creator>
      <dc:date>2022-12-07T13:22:05Z</dc:date>
    </item>
  </channel>
</rss>

