(layerInfo)
| 169 | } |
| 170 | |
| 171 | getWmsInfo(layerInfo) { |
| 172 | return new Promise(resolve => { |
| 173 | const proxy = this.handleProxy(); |
| 174 | const serviceUrl = Util.urlAppend(layerInfo.url, 'REQUEST=GetCapabilities&SERVICE=WMS'); |
| 175 | FetchRequest.get(serviceUrl, null, { |
| 176 | withCredentials: this.handleWithCredentials(proxy, layerInfo.url, false), |
| 177 | withoutFormatSuffix: true, |
| 178 | proxy |
| 179 | }) |
| 180 | .then(response => { |
| 181 | return response.text(); |
| 182 | }) |
| 183 | .then(capabilitiesText => { |
| 184 | const parser = new XMLParser({ ignoreAttributes: false, attributeNamePrefix: '@_' }); |
| 185 | const capabilities = parser.parse(capabilitiesText); |
| 186 | const wmsCapabilities = capabilities.WMT_MS_Capabilities || capabilities.WMS_Capabilities; |
| 187 | const latlonBounds = wmsCapabilities['Capability']['Layer']['LatLonBoundingBox']; |
| 188 | let bounds = null; |
| 189 | if (latlonBounds) { |
| 190 | bounds = [+latlonBounds['@_minx'], +latlonBounds['@_miny'], +latlonBounds['@_maxx'], +latlonBounds['@_maxy']]; |
| 191 | } |
| 192 | const EX_GeographicBoundingBox = wmsCapabilities['Capability']['Layer']['EX_GeographicBoundingBox']; |
| 193 | if (EX_GeographicBoundingBox) { |
| 194 | bounds = [+EX_GeographicBoundingBox['westBoundLongitude'], +EX_GeographicBoundingBox['southBoundLatitude'], +EX_GeographicBoundingBox['eastBoundLongitude'], +EX_GeographicBoundingBox['northBoundLatitude']]; |
| 195 | } |
| 196 | resolve({ version: wmsCapabilities['@_version'], bounds }); |
| 197 | }); |
| 198 | }); |
| 199 | } |
| 200 | |
| 201 | getMapBoxStyle(styleURL, withoutFormatSuffix = false) { |
| 202 | return new Promise((resolve, reject) => { |
no test coverage detected