|
16 | 16 | from folium.features import GeoJson, TopoJson |
17 | 17 | from folium.map import FitBounds, LegacyMap |
18 | 18 |
|
19 | | -import requests |
20 | | - |
21 | 19 |
|
22 | 20 | class Map(LegacyMap): |
23 | 21 | """Create a Map with Folium and Leaflet.js |
@@ -143,7 +141,7 @@ def fit_bounds(self, bounds, padding_top_left=None, |
143 | 141 | ) |
144 | 142 | ) |
145 | 143 |
|
146 | | - def choropleth(self, geo_path=None, geo_str=None, data_out='data.json', |
| 144 | + def choropleth(self, geo_data, data_out='data.json', |
147 | 145 | data=None, columns=None, key_on=None, threshold_scale=None, |
148 | 146 | fill_color='blue', fill_opacity=0.6, line_color='black', |
149 | 147 | line_weight=1, line_opacity=1, legend_name='', |
@@ -252,17 +250,6 @@ def choropleth(self, geo_path=None, geo_str=None, data_out='data.json', |
252 | 250 | raise ValueError('Please pass a valid color brewer code to ' |
253 | 251 | 'fill_local. See docstring for valid codes.') |
254 | 252 |
|
255 | | - # Create GeoJson object |
256 | | - if geo_path: |
257 | | - if geo_path.lower().startswith(('http:', 'ftp:', 'https:')): |
258 | | - geo_data = requests.get(geo_path).json() |
259 | | - else: |
260 | | - geo_data = open(geo_path) |
261 | | - elif geo_str: |
262 | | - geo_data = geo_str |
263 | | - else: |
264 | | - geo_data = {} |
265 | | - |
266 | 253 | # Create color_data dict |
267 | 254 | if hasattr(data, 'set_index'): |
268 | 255 | # This is a pd.DataFrame |
|
0 commit comments