Created
January 26, 2019 06:42
-
-
Save prakhar21/d1e9ffff4a9867abbe0656ad7482bd47 to your computer and use it in GitHub Desktop.
GeoSpatial Data Visualisation using Folium in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import folium | |
from folium.plugins import MarkerCluster | |
city_latlong = { | |
'Agra': [27.1767, 78.0081], 'Ahmedabad': [23.0225, 72.5714], 'Durgapur': [23.5204, 87.3119], | |
'Aurangabad': [19.8762, 75.3433], 'Bengaluru': [12.9716, 77.5946], 'Bhopal': [23.2599, 77.4126], | |
'Coimbatore': [11.0168, 76.9558], 'Delhi': [28.7041, 77.1025], 'Dhanbad': [23.7957, 86.4304], | |
'Faridabad': [28.4089, 77.3178], 'Ghaziabad': [28.6692, 77.4538], 'Gwalior': [26.2183, 78.1828], | |
'Hyderabad': [17.3850, 78.4867], 'Indore': [22.7196, 75.8577], 'Jaipur': [26.9124, 75.7873], | |
'Jabalpur': [23.1815, 79.9864], 'Jamshedpur': [22.8046, 86.2029], 'Jodhpur': [26.2389, 73.0243], | |
'Kochi': [9.9312, 76.2673], 'Kolkata': [22.5726, 88.3639], 'Kollam': [8.8932, 76.6141], | |
'Kota': [25.2138, 75.8648], 'Kannur': [11.8745, 75.3704], 'Lucknow': [26.8467, 80.9462], | |
'Ludhiana': [30.9010, 75.8573], 'Madurai': [9.9252, 78.1198], 'Mallapuram': [11.0510, 76.0711], | |
'Mumbai': [19.0760, 72.8777], 'Meerut': [28.9845, 77.7064], 'Nagpur': [21.1458, 79.0882], | |
'Patna': [25.5941, 85.1376], 'Pune': [18.5204, 73.8567], 'Rajkot': [22.3039, 70.8022], | |
'Surat': [21.1702, 72.8311], 'Thrissur': [10.5276, 76.2144], 'Vadodra': [22.3072, 73.1812], | |
'Varanasi': [25.3176, 82.9739], 'Visakhapatnam': [17.6868, 83.2185], | |
'Allahabad': [25.4358, 81.8463], 'Amritsar': [31.6340, 74.8723], 'Chandigarh': [30.7333, 76.7794], | |
'Chennai': [13.0827, 80.2707], 'Kanpur': [26.4499, 80.3319], 'Khozikode': [11.2588, 75.7804], | |
'Nashik': [19.9975, 73.7898], 'Raipur': [21.2514, 81.6296] | |
} | |
IND_COORDINATES = (20.5937, 78.9629) | |
map = folium.Map(location=IND_COORDINATES, zoom_start=3, control_scale=True) | |
marker_cluster = MarkerCluster().add_to(map) | |
for c,coord in city_latlong.items(): | |
folium.Marker( | |
location=coord, | |
popup=c, | |
icon=folium.Icon(color='green', icon='ok-sign') | |
).add_to(marker_cluster) | |
map.save(outfile='map.html') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment