Cant access XML source with mapbox (WMS)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**mapbox-gl-js version**: 4.7.4
### Question
I am trying to add to the map wms type but i cant make it work the network tab shows that error is not successful also the console gives this error:
`react_devtools_backend.js:4026 Error: Could not load image because of The source image could not be decoded.. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.
`
I followed the example in the docs but i cant make the url to work , here is my code:
```
map.addSource('wms-test-source', {
'type': 'raster',
'tiles': [
'https://e-kartta.ouka.fi/TeklaOgcWeb/WMS.ashx?bbox={bbox-epsg-3857}&service=WMS&request=GetCapabilities&format=image/png'
],
});
map.addLayer(
{
'id': 'wms-test-layer',
'type': 'raster',
'source': 'wms-test-source',
'paint': {},
'minzoom': 0,
'maxzoom': 22
},
'aeroway-line'
);
```
The url is XML format and is public: https://e-kartta.ouka.fi/TeklaOgcWeb/WMS.ashx?SERVICE=WMS&REQUEST=GetCapabilities
EDIT : if i put url like this it works. However works only with this layer.
` 'https://e-kartta.ouka.fi/TeklaOgcWeb/WMS.ashx?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3857&transparent=true&width=500&height=500&layers='Asemakaava'`
EDIT 2: Apperantly issue was in the wms service, they require authorization for some layers. This can be closed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the WMS raster-source example and compare the supplied GetCapabilities and GetMap URLs. No repository file or test is identified; the reported outcome is that the issue was caused by authorization in the external WMS service, so no Mapbox code change is specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 18/100