# Javascript error: Mapbox error

**URL:** <https://community.plotly.com/t/javascript-error-mapbox-error/71315>\
**Category:** 📊 Plotly Python\
**Created:** [January 4, 2023, 9:52am UTC](https://community.plotly.com/t/javascript-error-mapbox-error/71315 "2023-01-04T09:52:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndrewKuts](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@AndrewKuts](https://community.plotly.com/u/AndrewKuts)\
**Post date:** [January 4, 2023, 9:52am UTC](https://community.plotly.com/t/javascript-error-mapbox-error/71315/1 "2023-01-04T09:52:17Z")

</div>

I try to add output from the WMS server to a plotly.scatter\_mapbox.  
I use 2 different wms services. One of them works great, pulling the image from the server and displaying it on the figure.

fig = px.scatter\_mapbox(dfBoatTrack,  
lat=dfBoatTrack.lat,  
lon=dfBoatTrack.lon)  
fig.update\_layout(mapbox\_style=“open-street-map”)  
fig.update\_layout(  
mapbox\_style=“white-bg”,  
mapbox\_layers=[  
{  
“sourcetype”: “raster”,  
“sourceattribution”: “Government of Norway”,  
“source”: [“[https://wms.geonorge.no/skwms1/wms.sjokartraster2?service=wms&version=1.3.0&request=GetMap&bbox={bbox-epsg-3857}](https://wms.geonorge.no/skwms1/wms.sjokartraster2?service=wms&version=1.3.0&request=GetMap&bbox=%7Bbbox-epsg-3857%7D)”  
“&transparent=true&width=512&height=512&layers=all&CRS=EPSG:3857&format=image/png”],  
“below”: “traces”  
}  
])  
fig.update\_geos(fitbounds=“locations”)  
fig.update\_layout(height=800, width=800, margin={“r”:0,“t”:0,“l”:0,“b”:0})  
fig.show()

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/e/1/e1de522afffcf596fb95860c63f7cb8c8052352c.jpeg)

While another one causes unknown error, so I cannot find the solution and make it work.  
It shows only blank map with scatter dots and error message at the bottom.

fig = px.scatter\_mapbox(dfBoatTrack,  
lat=dfBoatTrack.lat,  
lon=dfBoatTrack.lon)  
fig.update\_layout(mapbox\_style=“open-street-map”)  
fig.update\_layout(  
mapbox\_style=“white-bg”,  
mapbox\_layers=[  
{  
“sourcetype”: “raster”,  
“sourceattribution”: “Government of Norway”,  
“source”: [“[https://gis.fiskeridir.no/server/services/fiskeridirWMS/MapServer/WMSServer?service=wms&request=getMap&bbox={bbox-epsg-3857}](https://gis.fiskeridir.no/server/services/fiskeridirWMS/MapServer/WMSServer?service=wms&request=getMap&bbox=%7Bbbox-epsg-3857%7D)”  
“&version=1.3.0&layers=all&CRS=EPSG:3857&format=image/png1”],  
“below”: “traces”  
}  
])

fig.update\_geos(fitbounds=“locations”)  
fig.update\_layout(height=800, width=800, margin={“r”:0,“t”:0,“l”:0,“b”:0})  
fig.show()

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/9/d/9d428558742024377ea2183b7a5915886c3859b2.png)

Any ideas?

---

<div class="post-metadata">

**Author:** ![RachelGomez161999](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@RachelGomez161999](https://community.plotly.com/u/RachelGomez161999)\
**Post date:** [January 6, 2023, 7:11am UTC](https://community.plotly.com/t/javascript-error-mapbox-error/71315/2 "2023-01-06T07:11:43Z")

</div>

Maps can fail to load for a variety of reasons related to your Mapbox account, your code, the browser you are using, the network you are on, or your computer.

Regards,  
Rachel Gomez

---

<div class="post-metadata">

**Author:** ![AndrewKuts](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@AndrewKuts](https://community.plotly.com/u/AndrewKuts)\
**Post date:** [January 6, 2023, 7:42am UTC](https://community.plotly.com/t/javascript-error-mapbox-error/71315/3 "2023-01-06T07:42:53Z")

</div>

I completely agree with you, RachelGomez161999  
It would be useful to have information about the error, to know where to dig.
