0

I was trying to create a map in Folium using a custom map built tile layer created with Mapbox Studio (using 3 different datasets and a satellite basemap). I was wondering if there is a simple way to add it with Folium? I read in the documentation that style layers and datasets had to be called separately. I tried with the following (and a few variations), but each time it loaded the Python data with no base map.

folium_map = folium.Map(location=[-8.907970, 33.433200],
                        zoom_start=7,
                        tiles='http://{s}.tiles.mapbox.com/v4/(username).(mapid)/{z}/{x}/{y}@2x.png?access_token=(access token)',
                        attr='Mapbox')

I was using Mapbox (instead of loading the datasets independently) because my datasets are pretty big (up to 100MB, upwards of 100,000 points) and that causes the Leaflet map to lag tremendously.

0

Perhaps this:

folium_map = folium.Map(location=[-8.907970, 33.433200],
                        zoom_start=7,
                        tiles='http://{s}.tiles.mapbox.com/v4/(username).(mapid)/{z}/{x}/{y}@2x.png',
                        attr='Mapbox',
                        API_key='(access token)'     
)
| improve this answer | |
0

This question appears to be a duplicate and was already marked as correct when answered over here. But, I also wanted to elaborate and say that you can get the style link by choosing to "share your style" using the Fulcrum integration method as pictured below. The biggest problem I have with using Mapbox api in folium is the exposure within the html file. This is too easily exploited by bots retrieving api and shooting up your map tile requests from use in others' maps: enter image description here

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.