Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import json
- import folium
- mapa = folium.Map([42.6526, -73.75],
- zoom_start=7,
- tiles='cartodbpositron')
- Polygons = json.loads(requests.get('url1').text)
- Points = json.loads(requests.get('url2').text)
- m.choropleth(
- geo_data=Polygons,
- data=Points,
- columns=['County', 'NUMBER'],
- key_on='County',
- fill_color='YlGn',
- threshold_scale=[20,36, 55, 82, 130, 200]
- )
- m.save(os.path.join('results', 'choropleth.html'))
- Polygons['features'][0]
- {'geometry': {'coordinates': [[[-73.6769432221678, 42.783420963053466],
- [-73.67721590705258, 42.78344343258996],
- [-73.67758969154735, 42.783474231941845],
- ...]],
- 'type': 'Polygon'},
- 'id': 0,
- 'properties': {'CALC_SqMi': 532.791778829,
- 'County': 'Albany',
- 'FID': 0,
- 'OBJECTID': 1,
- 'Shape_Area': 1379924372.27,
- 'Shape_Leng': 166077.834249},
- 'type': 'Feature'}
- Points['features'][0]
- {'geometry': {'coordinates': [-73.423071, 43.48507299999999], 'type':
- 'Point'},
- 'id': 0,
- 'properties': {'County': 'Washington',
- 'FID': 0,
- 'LAT': 43.485073,
- 'LON': -73.423071,
- 'NAME': 'Whitehall',
- 'NUMBER': 10,
- 'STID': 'WHIT'},
- 'type': 'Feature'}
Add Comment
Please, Sign In to add comment