Folium
- Folium is a powerful Python library that helps you create several types of Leaflet maps. ... To get an idea, just zoom/click around on the next map to get an impression.
Documentation
https://python-visualization.github.io/folium/
Pre-requisites:
Python
folium
Installation:
$ pip install folium
or
$ conda install -c conda-forge folium
Importing module:
import folium
create a map object:
m = folium.Map(tiles='Stamen Toner', zoom_start=4)
#different tiles (map styles) can be used, like 'Stamen Toner', 'Stamen Terrain', ...
m = folium.Map(location=[46.961580, -102.560670], tiles='Mapbox Bright', zoom_start=4)
#m = folium.Map(location=[Latitude, Longitude])
How to check the latitide and Longitude for any location:
folium.Marker(location=[46.961580, -102.560670],popup='india',icon=folium.Icon(icon='cloud')).add_to(m)
Now we are going to locate three famous places in India using their Latitude and Longitude and put the image over the location.So that we can easily find out where the locations are:
- Ayodhya RamMandir.
- Taj Mahal.
- Ladakh.
m = folium.Map(tiles='Stamen Toner', zoom_start=4)
ladakh = folium.features.CustomIcon("ladakh.jpg", icon_size=(100,100))
taj_mahhel = folium.features.CustomIcon("taj mahel.jpg", icon_size=(100,100))
rammandir= folium.features.CustomIcon("rammandir.jpg", icon_size=(100, 100))
folium.Marker([40.743720, -73.822030], tooltip="Ladakh", popup='Ladakh,India', icon=ladakh).add_to(m)
folium.Marker([39.760979, -84.192200], tooltip="Taj Mahal", popup='Taj Mahal,India', icon=taj_mahhel).add_to(m)
folium.Marker([54.464180, -110.182259], tooltip="Ayodhya RamMandir", popup='Ayodhya RamMandir,India', icon=rammandir).add_to(m)
print(m)
Code Links:
View source code in (.py)
View souce code in (.ipynb)
View HTML file
Live Demo:
Contributing
Please see CONTRIBUTING ,
CONTRIBUTING-CODE , CODE_OF_CONDUCT for details before you contribute.
LICENSE:
Copyright (c) 2020 Kushal Das
This project is licensed under the GNU General Public License v3.0
Let's connect! Find me on the web.
If you have any Queries or Suggestions, feel free to reach out to me.