[esri.layers.FeatureLayer] #load() Failed to load layer

7104
2
12-17-2018 02:54 AM
DanTurner2
New Contributor

[esri.layers.FeatureLayer] #load() Failed to load layer

message: "Feature layer must be created with either a url or a source"

name: "feature-layer:missing-url-or-source"

I'm getting a bunch of these errors when trying to load my webmap. It's only on some of the layers as others load fine. Here is my code:

require([
    "esri/WebMap",
    "esri/views/MapView",
    "esri/widgets/Legend",
    "esri/widgets/LayerList",
    "dojo/domReady!"
], function(
    WebMap, MapView, Legend, LayerList
) {

    var webmap = new WebMap ({
        portalItem: {
            id: "myId1234567890"
        }
    });

    var view = new MapView({
        container: "viewDiv",
        map: webmap
    });

    view.when(function() {
        var layerList = new LayerList({
            view: view
        }, "layerDiv");
    });
});

Thanks

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Dan,

   In those web maps you likely have one or more layers whose map service or feature service is failing. I tested several web map ids of mine and none had this issue.

Wasique
New Contributor

I am also getting same issue and i tried with different different Id but map can not loaded and showing error:

Wasique_0-1629874909438.png

My code is:

require([
"esri/views/MapView",
"esri/WebMap",
"esri/layers/FeatureLayer",
"esri/renderers/UniqueValueRenderer",
"esri/symbols/SimpleLineSymbol",
"esri/widgets/LayerList",
"dojo/query",
"bootstrap/Collapse",
"bootstrap/Dropdown",
"calcite-maps/calcitemaps-v0.3",
"dojo/dom",
"dojo/domReady!",

// Calcite Maps
"calcite-maps/calcitemaps-v0.10",
// Calcite Maps ArcGIS Support
"calcite-maps/calcitemaps-arcgis-support-v0.10"

], function (
MapView,
WebMap,
FeatureLayer,
UniqueValueRenderer,
SimpleLineSymbol,
LayerList,
query,
dom,
CalciteMaps,
CalciteMapArcGISSupport
) {
const layer = new FeatureLayer({

url: "https://services6.arcgis.com/KA88lzxweZ86kjDY/arcgis/rest/services/OBHareMap_WFL1/FeatureServer",

outFields: ["*"]
});

const webmap = new WebMap({

portalItem: { id: "fe0ae5ef40a94b5c82cd970ff5cba4a7" }
});

var mapView = new MapView({
container: "mapViewDiv",
map: webmap,
padding: { top: 25, bottom: 0 },
//center: [-118.80500,34.02700],
zoom: 13
});

mapView.then(function () {
var layerList = new LayerList({
view: mapView
});
mapView.ui.add(layerList, "top-right");
});
/// Get the screen point from the view's click event
mapView.on("click", function (event) {
var screenPoint = event.screenPoint;
// the hitTest() checks to see if any graphics in the view
// intersect the given screen point
mapView.hitTest(screenPoint)
.then(getGraphics);

});

0 Kudos