0

I need to know how i can add a custom tile in my map. I want to add the jawg matrix tile. I am having problem with the tile and attribute parameter. It is to my understanding that if we need to add a custom tile, we have to add two parameters after "zoom_start=10" on line = 7. Which are tile = ... and attr = .... There are built in tiles. Also "Lat", "Lon", and "elev" are data from "volcanoes.txt" Here is my code:

import folium
import pandas


data=pandas.read_csv("Volcanoes_USA.txt")
lat=list(data["LAT"])
lon=list(data["LON"])
elev=list(data["ELEV"])

map = folium.Map(location=[38.58, -99.09], zoom_start=10 )


fg = folium.FeatureGroup(name="My Map")
for lt, ln, el in zip(lat, lon, elev ):
    fg.add_child(folium.Marker(location=[lt, ln], popup=str(el)+" meters", icon=folium.Icon(colour="Blue")))

map.add_child(fg)

map.save("Map3.html")

I need to know how i can add a custom tile say for example "Jawg Matrix" from https://leaflet-extras.github.io/leaflet-providers/preview/ . I need help if this is even possible. Thank you.

1 Answers1

1

If I understand your issue correctly it is to apply another custom tile map but the standard "OpenStreetMaps". I came across the same issue and solved it with the help of this post.

The code that solved it for me was:

m = folium.Map(location=[lat, lng], zoom_start=10, tiles='https://{s}.basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}{r}.png', attr='CartoDB.Voyager', max_zoom=20)

The attr keyword is just to display the name of the used custom tiles in the lower right corner. Of course the "cartodcn" map is copyright protected, but I left it out here for illustration purposes. You can view the built in tiles on the official folium documentation. Hope this is helpful for you!

CodeSocke
  • 91
  • 1
  • 7