For example, I'd like to zoom from country, to states, to counties.

I don't see this option in the docs:

class folium.plugins.MarkerCluster(locations=None, popups=None, icons=None, name=None, overlay=True, control=True, show=True, icon_create_function=None, options=None, **kwargs)

But the Marker Cluster object does highlight contours when hovering over a cluster icon:

Folium Marker Cluster

  • I'm not familiar with the Folium version of MarkerCluster plugin, but JS version by default zooms to bounds of a cluster when you click on it. Option is called zoomToBoundsOnClick and is true by default. Try specifying this option in Options parameter. – TomazicM Apr 15 '20 at 20:17
  • Yes, but those bounds seem to be set under the hood by some algorithm. – zadrozny Apr 15 '20 at 20:53
  • Yes, algorithm is very simple: at any given zoom cluster together markers that are closer in pixels than value set by maxClusterRadius option (default value 80). There is no option to change this algorithm. – TomazicM Apr 16 '20 at 5:37
  • Thanks for clarifying. – zadrozny Apr 16 '20 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.