There were few Japanese documents about folium, so I tried to summarize the basic usage. (The text is for folium-0.2.1)
A package that makes it possible to use a library called Leaflet.js that can create interactive maps from python.
pip install pandas
pip install folium
# -*- coding:utf-8 -*-
#Sample when using folium with python
import folium
#Set Akashi City, Hyogo Prefecture as a map standard
japan_location = [35, 135]
#Create a map by specifying the reference point and the initial magnification
map = folium.Map(location=japan_location, zoom_start=5)
#Place a marker at the reference point s
marker = folium.Marker(japan_location, popup='Akashi')
map.add_children(marker)
#Output map in html format
map.save(outfile="map.html")
A map like this will be created
-When creating a map with folium.Map, you can specify map tiles with tiles.
# -*- coding:utf-8 -*-
#Sample of map tile specification
import folium
#Set Akashi City, Hyogo Prefecture as a map standard
japan_location = [35, 135]
#Create a map with map tiles as Stamen Terrian
map = folium.Map(location=japan_location, zoom_start=5, tiles="Stamen Terrain")
#Output map in html format
map.save(outfile="stamen_terrain_map.html")
・ As an object to be installed on the map CircleMarker, ClickForMarker, RegularPolygonMarker Etc. are available by default.
It is recommended because you can easily make a map that can be moved. Please use it.
https://pypi.python.org/pypi/folium http://www.hexacosa.net/blog/detail/147/ http://sinhrks.hatenablog.com/entry/2015/12/26/231000
Recommended Posts