Skip to main content

Maps in Python with Folium

Updated 1 min readMarkdown
Part of seriesPython notes
import folium

#define the world map
world_map = folium.Map()

#display world map
world_map

Now you have a world map.
You can customize this default definition of the world map by specifying the centre of your map and the intial zoom level.

# define the world map centered around Italy with a low zoom level
world_map = folium.Map(location=[41.53, 12.28], zoom_start=6)

# display world map
world_map

image.png

#if you want to display the physical map
world_map = folium.Map(location=[41.53, 12.28], zoom_start=6, tiles='Stamen Terrain')

#High contrast black and white map
world_map = folium.Map(location=[41.53, 12.28], zoom_start=6, tiles='Stamen Toner')

#add a marker with a pop-up label
binzago_map = folium.Map(location=[41.53, 12.28], zoom_start=6)
folium.features.CircleMarker(
        [45.62, 9.15],
        radius=10, #define how big you want the circle markers to be
        color='yellow',
        fill=True,
        popup=label,
        fill_color='red',
        fill_opacity=0.6
    ).add_child(folium.Popup('Binzago')).add_to(binzago_map)
binzago_map

image.png

About the author

  • data engineer • T-SQL developer • r and python • Power BI and tableau • machine learning enthusiast • data lover

    Follow back granted

No comments yet. Be the first to comment.