Skip to content

Instantly share code, notes, and snippets.

View abhishek-shrm's full-sized avatar

ABHISHEK SHARMA abhishek-shrm

  • ZS Associates
  • New Delhi, India
View GitHub Profile
fig2=Figure(width=550,height=350)
m2=folium.Map(location=[28.644800, 77.216721])
fig2.add_child(m2)
folium.TileLayer('Stamen Terrain').add_to(m2)
folium.TileLayer('Stamen Toner').add_to(m2)
folium.TileLayer('Stamen Water Color').add_to(m2)
folium.TileLayer('cartodbpositron').add_to(m2)
folium.TileLayer('cartodbdark_matter').add_to(m2)
folium.LayerControl().add_to(m2)
m2
# Creating Basemap
fig3=Figure(width=550,height=350)
m3=folium.Map(location=[28.644800, 77.216721],tiles='cartodbpositron',zoom_start=11)
fig3.add_child(m3)
#Adding markers to the map
folium.Marker(location=[28.695800, 77.244721],popup='Default popup Marker1',tooltip='Click here to see Popup').add_to(m3)
folium.Marker(location=[28.645800, 77.214721],popup='<strong>Marker3</strong>',tooltip='<strong>Click here to see Popup</strong>').add_to(m3)
folium.Marker(location=[28.655800, 77.274721],popup='<h3 style="color:green;">Marker2</h3>',tooltip='<strong>Click here to see Popup</strong>').add_to(m3)
# Creating Basemap
fig4=Figure(height=350,width=550)
m4=folium.Map(location=[28.4911091,77.0867361],tiles='cartodbpositron',zoom_start=11)
fig4.add_child(m4)
# Adding Custom Markers
folium.Marker(location=[28.4211091,77.0267361],popup='Custom Marker 1',tooltip='<strong>Click here to see Popup</strong>',icon=folium.Icon(color='red',icon='none')).add_to(m4)
folium.Marker(location=[28.4411091,77.1167361],popup='Custom Marker 2',tooltip='<strong>Click here to see Popup</strong>',icon=folium.Icon(color='green',prefix='glyphicon',icon='off')).add_to(m4)
folium.Marker(location=[28.4511091,77.1667361],popup='Custom Marker 3',tooltip='<strong>Click here to see Popup</strong>',icon=folium.Icon(color='purple',prefix='fa',icon='anchor')).add_to(m4)
folium.Marker(location=[28.4911091,77.0867361],popup='Custom Marker 4- <b>Analytics Vidhya</b>',tooltip='<strong>Click here to see Popup</strong>',icon=folium.features.CustomIcon('av.png',icon_size=(50,50))).add_to(m4)
coords_1=[[28.65685,77.21899],[28.65699,77.21898],[28.65699,77.21898],
[28.65702,77.21875],[28.65702,77.21875],[28.6547,77.21902],[28.65308,77.21921],
[28.65286,77.21926],[28.65255,77.21938],[28.65227,77.21954],[28.65152,77.22005],
[28.64655,77.22346],[28.64643,77.22354],[28.64635,77.22357],[28.64623,77.2236],
[28.64616,77.22363],[28.64612,77.22364],[28.64557,77.22364],[28.64525,77.22365],
[28.64525,77.22365],[28.64517,77.22366],[28.64515,77.22367],[28.64512,77.22367],
[28.64504,77.22369],[28.64493,77.22371],[28.64483,77.22373],[28.64462,77.22377],
[28.6445,77.22381],[28.64444,77.22383],[28.64439,77.22387],[28.64434,77.2239],
[28.64429,77.22395],[28.64421,77.22403],[28.64417,77.22412],[28.64407,77.22429],
[28.64391,77.22465],[28.64353,77.22539],[28.64282,77.22678],[28.64282,77.22678],
fig5=Figure(height=550,width=750)
m5=folium.Map(location=[28.644800, 77.216721],tiles='cartodbpositron',zoom_start=14)
fig5.add_child(m5)
# Creating feature groups
f1=folium.FeatureGroup("Vehicle 1")
f2=folium.FeatureGroup("Vehicle 2")
f3=folium.FeatureGroup("Vehicle 3")
# Adding lines to the different feature groups
line_1=folium.vector_layers.PolyLine(coords_1,popup='<b>Path of Vehicle_1</b>',tooltip='Vehicle_1',color='blue',weight=10).add_to(f1)
line_2=folium.vector_layers.PolyLine(coords_2,popup='<b>Path of Vehicle_2</b>',tooltip='Vehicle_2',color='red',weight=10).add_to(f2)
line_3=folium.vector_layers.PolyLine(coords_3,popup='<b>Path of Vehicle_3</b>',tooltip='Vehicle_3',color='green',weight=10).add_to(f3)
f1.add_to(m5)
f2.add_to(m5)
f3.add_to(m5)
folium.LayerControl().add_to(m5)
m5
import numpy as np
import pandas as pd
# For plotting maps
import folium
# For Regular Expressions
import re
# For working with geographical data
df_covid=pd.read_csv('/covid19-corona-virus-india-dataset/complete.csv')
df_covid.head()
india_geojson=geopandas.read_file('/india-geojson/india_geo.json')
india_geojson.head()