Skip to content

Instantly share code, notes, and snippets.

@Dhrumilcse
Created September 22, 2019 21:17
Show Gist options
  • Save Dhrumilcse/538ab5c83281b15d1073b29843194d81 to your computer and use it in GitHub Desktop.
Save Dhrumilcse/538ab5c83281b15d1073b29843194d81 to your computer and use it in GitHub Desktop.
#Import Library
import folium
import pandas as pd
from folium.plugins import MarkerCluster
#Load Data
data = pd.read_excel("tesla-supercharger-france.xlsx")
latitude = data['Ylatitude']
longitude = data['Xlongitude']
station = data['n_station']
#Create base map
map = folium.Map(location=[47.85183, 3.542802], zoom_start = 6, tiles = "cartodbpositron")
marker_cluster = MarkerCluster().add_to(map)
#Plot Marker with custom Icon and Marker Cluster
for latitude, longitude, station in zip(latitude, longitude, station):
icon_path = "tesla-iconn.png"
icon = folium.features.CustomIcon(icon_image=icon_path ,icon_size=(30,30))
folium.Marker(location=[latitude, longitude], popup=str(station), icon = icon).add_to(marker_cluster)
#Save the map
map.save("map.html")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment