地图的可视化–Folium

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_csvstate_unemployment)
printstate_data)

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

# create the leaflet map settings
map.geo_jsongeo_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_mappath='../www/html/ch10-01_folium_map.html')

3.修改WebMap页面

image

<!--
<script src="https://gapis.geekzu.org/ajax/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页面

image

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注