Guest User

Untitled

a guest
Mar 23rd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. import requests
  2. import json
  3. import folium
  4.  
  5. mapa = folium.Map([42.6526, -73.75],
  6. zoom_start=7,
  7. tiles='cartodbpositron')
  8.  
  9. Polygons = json.loads(requests.get('url1').text)
  10. Points = json.loads(requests.get('url2').text)
  11.  
  12. m.choropleth(
  13. geo_data=Polygons,
  14. data=Points,
  15. columns=['County', 'NUMBER'],
  16. key_on='County',
  17. fill_color='YlGn',
  18. threshold_scale=[20,36, 55, 82, 130, 200]
  19. )
  20.  
  21. m.save(os.path.join('results', 'choropleth.html'))
  22.  
  23. Polygons['features'][0]
  24.  
  25. {'geometry': {'coordinates': [[[-73.6769432221678, 42.783420963053466],
  26. [-73.67721590705258, 42.78344343258996],
  27. [-73.67758969154735, 42.783474231941845],
  28. ...]],
  29. 'type': 'Polygon'},
  30. 'id': 0,
  31. 'properties': {'CALC_SqMi': 532.791778829,
  32. 'County': 'Albany',
  33. 'FID': 0,
  34. 'OBJECTID': 1,
  35. 'Shape_Area': 1379924372.27,
  36. 'Shape_Leng': 166077.834249},
  37. 'type': 'Feature'}
  38.  
  39. Points['features'][0]
  40.  
  41. {'geometry': {'coordinates': [-73.423071, 43.48507299999999], 'type':
  42. 'Point'},
  43. 'id': 0,
  44. 'properties': {'County': 'Washington',
  45. 'FID': 0,
  46. 'LAT': 43.485073,
  47. 'LON': -73.423071,
  48. 'NAME': 'Whitehall',
  49. 'NUMBER': 10,
  50. 'STID': 'WHIT'},
  51. 'type': 'Feature'}
Add Comment
Please, Sign In to add comment