I'm working with JavaScript API 4.12.
I tried using the url in Sample - WMSLayer which should work fine but instead giving me the error '[esri.layers.WMSLayer] #load() Failed to load layer (title: 'WMS Layer', id: '16ef4567998-layer-4') TypeError: Cannot read property 'indexOf' of undefined'.
let wmsLayer = new WMSLayer({
title: "WMS Layer",
url: "https://ows.terrestris.de/osm/service",
sublayers: [
{
name: "OSM-WMS"
}
]
});
Thought it was a spatial reference relevant error, I've tried setting 'wmsLayer.spatialReference = 102100;' but still got the same error. After googling WMS url usage, I tried putting the url with the complete parameters and got a 'XML Parse error'.
let wmsLayer = new WMSLayer({
title: "WMS Layer",
url: "https://neo.sci.gsfc.nasa.gov/wms/wms?version=1.3.0&request=GetMap&layers=MOD14A1_M_FIRE&style=rgb&crs=CRS:84&bbox=-180,-90,180,90&width=720&height=360&format=image/png"
});
var basemap = new Basemap({
baseLayers: [wmsLayer]
});
var map = new Map({
basemap: basemap,
layers: [gridLayer, forceSymbolLayer, measurementLayer, sketchLayer]
});
I'm new to the GIS development, and really confused about the WMS format to set as the url, especially when the sample from official website doesn't work.