3

Are there any chances to add grid on Folium map? Something like on this picture.

enter image description here

6

You can add graticules as polylines. First, set intervals of latitude and longitude.

import folium

m = folium.Map()

lat_interval = 10
lon_interval = 10
grid = []

for lat in range(-90, 91, lat_interval):
    grid.append([[lat, -180],[lat, 180]])

for lon in range(-180, 181, lon_interval):
    grid.append([[-90, lon],[90, lon]])

for g in grid:
    folium.PolyLine(g, color="black", weight=0.5, opacity=0.5).add_to(m)

m

enter image description here

Shorter version of the script:

import folium

m = folium.Map()
lat_interval = 10
lon_interval = 10

for lat in range(-90, 91, lat_interval):
     folium.PolyLine([[lat, -180],[lat, 180]], weight=0.5).add_to(m)

for lon in range(-180, 181, lon_interval):
    folium.PolyLine([[-90, lon],[90, lon]], weight=0.5).add_to(m)

m
| improve this answer | |

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