Skip to content

Kushal997-das/Webmap

Repository files navigation

Hello programmer Welcome to this repo GitHub issues GitHub forks GitHub stars GitHub contributors

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])

Output1

That's how the map look like after executing the code.

How to check the latitide and Longitude for any location:

https://www.latlong.net/


In the above map we are unable to find the exact location right? That's the reason we are using icon for this and also use popup for displaying the location name.

folium.Marker(location=[46.961580, -102.560670],popup='india',icon=folium.Icon(icon='cloud')).add_to(m)

output2

That's how the map look like after executing the code.

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)

png


Code Links:

View source code in (.py)
View souce code in (.ipynb)
View HTML file

Live Demo:

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.

Show some  ❤️  by starring some of the repositories!