-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Choropleth take gdf #703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Choropleth take gdf #703
Conversation
folium/folium.py
Outdated
| ) | ||
|
|
||
| def choropleth(self, geo_path=None, geo_str=None, data_out='data.json', | ||
| def choropleth(self, geo_data, data_out='data.json', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C901 'Map.choropleth' is too complex (17)
|
Quick comment -- I'm in a rush. From your example: m.choropleth(
geo_data=quartiers,
data=quartiers,
columns=['objectid', 'number_bike_stations_relative'],
key_on='feature.properties.objectid',
fill_color='BuGn',
highlight=True
)This isn't a big improvement, I think 😿. With a GeoDataFrame as the input, it's not necessary to have separate Maybe you should push the choropleth enhancement to the next release, so as not to delay you further?? |
One step at a time 😉 This PR only factors out the geojson parser to a canonical place instead of parsing it here and later again in the However, to implement what you request we would need a complex API to cover all the possibilities. The reason I don't want to change this function is b/c the geojson+df is the most primitive combination that we can support. I cannot add |
|
Got it. To be clear, I wasn't suggesting the other arguments be dropped. I was just trying to clarify that when both Having Thanks! |
| fill_color='blue', fill_opacity=0.6, line_color='black', | ||
| line_weight=1, line_opacity=1, legend_name='', | ||
| topojson=None, reset=False, smooth_factor=None, | ||
| def choropleth(self, geo_data, data=None, columns=None, key_on=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C901 'Map.choropleth' is too complex (17)
It is not about dropping. We cannot make a complex API that takes both the primitive and the high level. |
|
Worth mentioning that this PR addresses issue #499 |
I discussed this with other
We would always need to know the column to "keyon" the data b/c that is not standardized. In this example it is named
That can be easily wrapped and, If we assume that the That takes the |
|
@ocefpaf, no worries. The decisions are all understandable. I'm excited to see you finally issued a new folium release, a few hours ago. Congratulations!! Thanks for the sample wrapper. I think I can simplify it even further; I'll let you know. FYI, @lsetiawan and I will be asking you for help on the new release of Folium this week ;) To make sure we and our fellow GeoHackweek tutors are using it to its full potential, and using current best practices. |
Yep. The more you can assume about the underlying data the more you can simplify that. I sent a PR to your repository with that example.
No problem. There will be bugs 😄 |
…ake_gdf Choropleth take gdf
Ping @emiliom who is interested in this feature.
See it in action here http://nbviewer.jupyter.org/gist/ocefpaf/9ecac736938af0c09b8f14a3850b11fb
I am refactoring the GeoJSON reader too, but I guess I'll stop now so we can have a new release.