question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Toggle or Show parameter for choropleth layers not working as expected

See original GitHub issue

#### Please add a code sample or a nbviewer link, copy-pastable if possible

m.choropleth(name = 'Registered Electric Vehicles',geo_data = zips, data = zips, key_on='feature.properties.ZIP',
                     columns=['ZIP','EV'], fill_color='BuGn', line_weight = 0.3, line_opacity = 0.5,
                     fill_opacity = 0.5, legend_name = 'Registered Electric Vehicles', 
                     smooth_factor = 1, toggle = True)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-54-828389e26172> in <module>()
     11                      columns=['ZIP','PHEV'], fill_color='RdPu', line_weight = 0.3, line_opacity = 0.5,
     12                      fill_opacity = 0.5, legend_name = 'Registered Plug-in Hybrids',
---> 13                      smooth_factor = 1, toggle = True)
     14 m.choropleth(name = 'Registered Electric Vehicles',geo_data = zips, data = zips, key_on='feature.properties.ZIP',
     15                      columns=['ZIP','EV'], fill_color='BuGn', line_weight = 0.3, line_opacity = 0.5,

TypeError: choropleth() got an unexpected keyword argument 'toggle'

Problem description

I have a map with multiple choropleth layers that I want available to select in LayerControl, but I only want one to display on load.

Based on #772 and #606 it seems like anything inheriting the Layer class should have the parameter toggle to enable or disable the layer on load. This doesn’t work for choropleths, which I had thought inherited the Layer class. I’ve also tried adding the choropleth to a FeatureGroup with show = False, but this doesn’t work because choropleth is a method of a Map object.

What am I doing wrong? or is there not currently a way to only display one choropleth layer on load?

Output of folium.__version__

0.6.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
skoebcommented, Nov 7, 2018

Thanks @conengmo! This is a great improvement and lets me delete a lot of spaghetti.

1reaction
Conengmocommented, Nov 7, 2018

choropleths are now made by using the Choropleth class, which has a show argument. See also the example notebook on geojson and choropleths.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Toggle or Show parameter for choropleth layers not working as ...
Toggle or Show parameter for choropleth layers not working as expected. ... m.choropleth(name = 'Registered Electric Vehicles',geo_data = zips, data = zips, ...
Read more >
Choropleth layer selection does not work in Leaflet
1 Answer 1 · In event processing function change you set new event processing with $("select"). · For adding and removing layers with...
Read more >
Using Choropleth Layers with HANA Cloud and SAP Analytics ...
If your geo maps are still not working, check the location dimension is still valid and defined as expected. Figure%3A. Figure: 5.1 Click...
Read more >
Multiple choropleth layers apply different styles - Stack Overflow
I'm looking to have 2 different choropleth layers available for the user to select in the layer control that are displayed one at...
Read more >
Map board - Palantir
Cluster; Choropleth; Line segment. Currently, static layers (which are commonly used in Workshop maps) are not supported in the map board.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found