码迷,mamicode.com
首页 > 其他好文 > 详细

地图的可视化--Folium

时间:2016-08-21 09:44:43      阅读:2630      评论:0      收藏:0      [点我收藏+]

标签:

1.安装folium

pip install MarkupSafe-0.23-cp34-none-win_amd64.whl

pip install Jinja2-2.8-py2.py3-none-any.whl

pip install folium

 

2.生成WebMap页面

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import folium
import pandas as pd

# define the polygons
states_geojson = r../www/html/us-states.json

# statistic data to connect to our polygons
state_unemployment = r../www/html/US_Unemployment_Oct2012.csv

# read the csv statistic data
state_data = pd.read_csv(state_unemployment)
print(state_data)

# Let Folium determine the scale
map = folium.Map(location=[48, -102], zoom_start=3, tiles="Stamen Toner")

# create the leaflet map settings
map.geo_json(geo_path=states_geojson, data=state_data,
             columns=[State, Unemployment],
             threshold_scale=[5, 6, 7, 8, 9, 10],
             key_on=feature.id,
             fill_color=YlGn, fill_opacity=0.7, line_opacity=0.2,
             legend_name=Unemployment Rate (%))

# output the final map file
map.create_map(path=../www/html/ch10-01_folium_map.html)

 

3.修改WebMap页面

技术分享

<!--
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
-->

<script src="http://127.0.0.1/resource/JavaScript/gis/geojquery/jquery-1.11.2.min.js"></script>

 

4.访问WebMap页面

技术分享

地图的可视化--Folium

标签:

原文地址:http://www.cnblogs.com/gispathfinder/p/5792137.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!