Na parte da aula MAPAS CAMADA SIMPLES
base = folium.Map([y, x], zoom_start=11, tiles='OpenStreetMap')
base.choropleth(rj)
base
este codigo da um erro:
FutureWarning: The choropleth method has been deprecated. Instead use the new Choropleth class, which has the same arguments. See the example notebook 'GeoJSON_and_choropleth' for how to do this. FutureWarning
RuntimeError Traceback (most recent call last) in () 1 base = folium.Map([y, x], zoom_start=11, tiles='OpenStreetMap') ----> 2 base.choropleth(rj) 3 base
~\Anaconda3\lib\site-packages\folium\folium.py in choropleth(self, args, **kwargs) 416 ) 417 from folium.features import Choropleth --> 418 self.add_child(Choropleth(args, **kwargs)) 419 420 def keep_in_front(self, *args):
~\Anaconda3\lib\site-packages\folium\features.py in init(self, geo_data, data, columns, key_on, bins, fill_color, nan_fill_color, fill_opacity, nan_fill_opacity, line_color, line_weight, line_opacity, name, legend_name, overlay, control, show, topojson, smooth_factor, highlight, **kwargs) 1249 style_function=style_function, 1250 smooth_factor=smooth_factor, -> 1251 highlight_function=highlight_function if highlight else None) 1252 1253 self.add_child(self.geojson)
~\Anaconda3\lib\site-packages\folium\features.py in init(self, data, style_function, highlight_function, name, overlay, control, show, smooth_factor, tooltip, embed, popup) 451 self.highlight = highlight_function is not None 452 --> 453 self.data = self.process_data(data) 454 455 if self.style or self.highlight:
~\Anaconda3\lib\site-packages\folium\features.py in process_data(self, data) 493 self.embed = True 494 if hasattr(data, 'to_crs'): --> 495 data = data.to_crs('EPSG:4326') 496 return json.loads(json.dumps(data.geo_interface)) 497 else:
~\Anaconda3\lib\site-packages\geopandas\geodataframe.py in to_crs(self, crs, epsg, inplace) 384 else: 385 df = self.copy() --> 386 geom = df.geometry.to_crs(crs=crs, epsg=epsg) 387 df.geometry = geom 388 df.crs = geom.crs
~\Anaconda3\lib\site-packages\geopandas\geoseries.py in to_crs(self, crs, epsg) 284 raise TypeError('Must set either crs or epsg for output.') 285 proj_in = pyproj.Proj(self.crs, preserve_units=True) --> 286 proj_out = pyproj.Proj(crs, preserve_units=True) 287 project = partial(pyproj.transform, proj_in, proj_out) 288 result = self.apply(lambda geom: transform(project, geom))
~\Anaconda3\lib\site-packages\pyproj_init__.py in new(self, projparams, preserveunits, *kwargs) 356 # on case-insensitive filesystems). 357 projstring = projstring.replace('EPSG','epsg') --> 358 return proj.Proj._new__(self, projstring) 359 360 def call(self, *args, *kw):
proj.pyx in proj.Proj._cinit__ (proj.c:1170)()
RuntimeError: b'no arguments in initialization list'
Procurei alguns exemplos e achei outros que também não funcionam:
:
import pandas as pd
url = 'https://raw.githubusercontent.com/python-visualization/folium/master/examples/data'
state_geo = f'{url}/us-states.json'
state_unemployment = f'{url}/US_Unemployment_Oct2012.csv'
state_data = pd.read_csv(state_unemployment)
m = folium.Map(location=[48, -102], zoom_start=3)
folium.Choropleth(
geo_data=state_geo,
name='choropleth',
data=state_data,
columns=['State', 'Unemployment'],
key_on='feature.id',
fill_color='YlGn',
fill_opacity=0.7,
line_opacity=0.2,
legend_name='Unemployment Rate (%)'
).add_to(m)
folium.LayerControl().add_to(m)
m
Gostaria de alguma orientação, muito obrigado!