I'm getting #load() Failed to load layer TypeError: Cannot read property 'indexOf' of undefined
error when I tried to load WMSLayer in my application.
I've tried several different WMS service URLs but with no positive results. The code from the official sample doesn't work either.
A similar question has been asked and someone suggested that using proxy might solve the issue, but implementing proxy seems to be a quite complicated process. Please note that the URL in the question has http
instead of https
like in my application, the error is different from what I'm getting as well.
Does anyone figure out what I'm doing wrong or anything I missed out?
Here's my code :
let wmsLayer = new WMSLayer({
title: "WMS Layer",
url: "https://ows.terrestris.de/osm/service",
sublayers: [{
name: "OSM-WMS"
}]
});
var basemap = new Basemap({
baseLayers: [wmsLayer]
});
var map = new Map({
basemap: basemap,
layers: [gridLayer, forceSymbolLayer, measurementLayer, sketchLayer]
});
var mapView = new MapView({
map: map,
zoom: initZoom,
center: initPosition
});