POST
|
Hi All, I am new to the ESRI js API 4.15. I have understood the way the WMSLayers work on the API. The issue I am having is with the Legend for the WMSLayer. The legendUrl under the WMSLayers/sublayers is a GeoServer end point with some custom Parameters. The WMS Layer gets added to the map just fine.... But the Legend does not appear as the URL get tacked together for both the getMap and GetLegendGraphic. So the Image does not appear. Can anyone help me with this? Here is snapshot of what is happening. Here is my code : wmsLayer = new WMSLayer({ id: tax_id, url: "Some Geoserver WMS Service", visible: true, customLayerParameters: { SERVICE: "WMS", FORMAT: "image/png", TRANSPARENT: "TRUE", CRS: "EPSG:102100", STYLES: '', REQUEST: "GetMap", LAYERS: layerText, cql_filter: filterText, WIDTH: width, HEIGHT: height, BBOX: bBox, crs: "EPSG:3857", spatialReferences: [3875, 3875, 3875] }, version: "1.3.0", imageFormat: "png", opacity: 0.75, sublayers: [{ name: "Species Observations", legendUrl: "GeoServer URL where the Legend Graphic is available" }], }) map.add(wmsLayer);
... View more
04-21-2020
12:40 PM
|
0
|
0
|
975
|
POST
|
Sure Anne, Here is my code. Just for a context of what I am working on...... Default Map get Created with no WMS Layers => User Selects an Animal Name from a Input box => Once use selects an Animal => There are 3 checkboxes made => On clicking one of these checkboxes, a layer on the WMS layer get created which is a distribution model image.... This process goes on for more than 1 type of Animal where I make more than 1 WMS layer and toggle their visibility if there are no checkboxes for that animal selected. The code is as follows..... This Function makes a new layer conditionally... function makeLayer(filterText, layerText, tax_id, bBox) { console.log(bBox); wmsLayer = new WMSLayer({ id: tax_id, url: Some Service URL, visible: true, customLayerParameters: { SERVICE: "WMS", FORMAT: "image/png", TRANSPARENT: "TRUE", CRS: "EPSG:102100", STYLES: '', REQUEST: "GetMap", LAYERS: layerText, cql_filter: filterText, WIDTH: width, HEIGHT: height, BBOX: bBox, crs: "EPSG:3857", spatialReferences: [3875, 3875, 3875] }, version: "1.3.0", featureInfoFormat: "image/png", imageFormat: "png", WMSSublayer: [] }) this.wmsLayer = wmsLayer; this._ORD = []; this.taxon_id = tax_id; map.add(wmsLayer) console.log(wmsLayer) } This is the function that takes care of the checkbox state change and tries to update the Layer. This is where I am having trouble... //Empty the Layer and Filter Texts layerText = ''; filterText = ''; //new Arrays for grouping the text var layerSelect = []; var filterAttr = []; var visibleLayers = []; //push the selected Checkboxes into the griuping arrays console.log("Change Occured for the Taxon " + taxon) $('div#' + taxon + ' input:checked').each(function() { layerSelect.push($(this).attr('id')); filterAttr.push($(this).data('filter')); }); //String Manipulate the Arrays filterAttr = filterAttr.map(function(e) { return "taxon_id='" + taxon + "'" + e }); layerSelect = layerSelect.join(); filterAttr = filterAttr.join(";"); //Assign arrays to arguments layerText = layerSelect; filterText = filterAttr; tax_id = "some_" + taxon; if (availableList.indexOf(tax_id) == -1) { //make new layer if layer does not exist new makeLayer(filterText, layerText, tax_id, bBox); console.log("Making a new layer!"); availableList.push(tax_id); console.log(availableList) } else { if (layerText.length != 0 && filterText.length != 0) { //check and Update the current layers if (wmsLayer.id != "some" + taxon) { console.log("Do Nothing"); } else { console.log("DO UPDATE") this.wmsLayer.visible = true; this.wmsLayer.customLayerParameters.cql_filter = ''; this.wmsLayer.customLayerParameters.cql_filter = filterText; this.wmsLayer.customLayerParameters.layers = ''; this.wmsLayer.customLayerParameters.layers = layerText; this.wmsLayer.customLayerParameters.bbox = bBox; this.wmsLayer.refresh() } } else { console.log(layerText); console.log(filterText); console.log(this.wmsLayer.id); this.wmsLayer.visible = false; this.wmsLayer.refresh(); visibleLayers = visibleLayers.filter(item => item !== tax_id); console.log(visibleLayers); } } }
... View more
04-08-2020
04:32 PM
|
0
|
0
|
362
|
POST
|
Hi All, I am new to the ESRI js API 4.14. I have an application where I render a default map and then conditionally add new WMS Layers. Each of these have a unique ID which are defined by the WMSLayer.id object. Now when I update the properties for 1 layer using this.wmsLayer.{SomeProperty} , It works just fine. When I have more than 1 layer then this.wmsLayer updates another layer rather than my current layer. I am looking for a way to update the specific layer. Is there a way to do this by ID? Thanks!
... View more
04-08-2020
02:56 PM
|
0
|
2
|
419
|
POST
|
Hi All, My Frontend framework is React.js and I am using the esri-loader for ArcGIS purpose. I am trying to load a WMS Layer on my Map which throws an error at the end saying .... [esri.layers.WMSLayer] #load() Failed to load layer (title: 'Layer', id: '1713b9d394f-layer-0') dname: "request:server"message: "XML Parse error"details: {url: "http://localhost:3001/wms", requestOptions: {…}, ssl: false, httpStatus: 0, getHeader: ƒ, …}__proto__: a The reponse for this gives the appopriate image for the filter used, but the layer fails to load. It has an XML error which is weird to me. I can check and confirm the response image from the network tab on the browser. Here is my code...... var layer = new WMSLayer({ url: "/wms?SERVICE=WMS&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=TRUE&STYLES=&VERSION=1.3.0&LAYERS=generalized_observations,generalized_distribution_models&WIDTH=1213&HEIGHT=977&CRS=EPSG:102100&BBOX=-12620287.761277478,4667834.219005647,-11136797.916319173,5862697.845159206&cql_filter=taxon_id%3D%273699%27%3Btaxon_id%3D%273699%27%20AND%20model_mean%20%3E%200&crs=EPSG%3A3857", // url to the service, }); Any help is greatly appreciated! Thanks! var layer = new WMSLayer({ url: "/wms?SERVICE=WMS&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=TRUE&STYLES=&VERSION=1.3.0&LAYERS=generalized_observations,generalized_distribution_models&WIDTH=1213&HEIGHT=977&CRS=EPSG:102100&BBOX=-12620287.761277478,4667834.219005647,-11136797.916319173,5862697.845159206&cql_filter=taxon_id%3D%273699%27%3Btaxon_id%3D%273699%27%20AND%20model_mean%20%3E%200&crs=EPSG%3A3857", // url to the service, }); // var layerRoads = new WMSLayer({ // url: "https://ows.terrestris.de/osm/service", // sublayers: [ // { // name: "OSM-WMS" // } // ] // }); console.log(layer) const map = new Map({ //basemap: "topo", basemap: { baseLayers : [layer], visible: true }, //layers: [layer2] }); this.view = new MapView({ container: this.mapRef.current, map: map, spatialReference: [3857,3857,3857], // center: [-107, 43], // zoom: 7 , });
... View more
04-02-2020
09:07 AM
|
0
|
0
|
543
|
POST
|
Hi All, I am new to the ESRI Community as well as the ESRI ArcGIS Javascript API. I am using React.js as my Framework and the 'esri-loader' for the API Part. Can anyone give me a rudimentary example of how I would render a WMS Layer as an image/png on to the base map? Any help would be greatly appreciated. Thanks!
... View more
04-01-2020
12:51 PM
|
1
|
2
|
1060
|
Title | Kudos | Posted |
---|---|---|
1 | 04-01-2020 12:51 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|