Skip to content

Add zoom_control option to Map() #899

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

Merged
merged 8 commits into from
Jun 29, 2018
Merged

Add zoom_control option to Map() #899

merged 8 commits into from
Jun 29, 2018

Conversation

okomarov
Copy link
Contributor

Enhancement #795: add a zoom_control option to the map creation (default: True)

Use case: create a .gif from 30+ snapshots of the map. The zoom controls do not serve any purpose and clutter the view.

If averse to adding kwargs to the Map() constructor, I could create a set method for ex-post toggle of the zoom controls.

Copy link
Member

@Conengmo Conengmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks good to me. I don't mind having this in kwargs, though in general I think we should be careful not to bloat it.

Two requests before merging this:

  • Add a line to the changelog
  • The Travis tests failed, can you check it out and fix the test that was affected by your edit?

folium/folium.py Outdated
@@ -197,7 +199,8 @@ class Map(MacroElement):
maxBounds: bounds,
layers: [],
worldCopyJump: {{this.world_copy_jump.__str__().lower()}},
crs: L.CRS.{{this.crs}}
crs: L.CRS.{{this.crs}},
zoomControl: {{this.zoom_control.__str__().lower()}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a trailing comma after the line you added

@okomarov
Copy link
Contributor Author

@Conengmo Thanks for the quick feedback.

Travis is not failign a test per se but failing to import:

==================================== ERRORS ====================================
________ ERROR collecting tests/plugins/test_time_slider_choropleth.py _________
ImportError while importing test module '/tmp/tests/plugins/test_time_slider_choropleth.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/home/travis/miniconda/envs/TEST/lib/python2.7/site-packages/_pytest/python.py:468: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
/home/travis/miniconda/envs/TEST/lib/python2.7/site-packages/py/_path/local.py:668: in pyimport
    __import__(modname)
/home/travis/miniconda/envs/TEST/lib/python2.7/site-packages/_pytest/assertion/rewrite.py:216: in load_module
    py.builtin.exec_(co, mod.__dict__)
tests/plugins/test_time_slider_choropleth.py:16: in <module>
    import geopandas as gpd
/home/travis/miniconda/envs/TEST/lib/python2.7/site-packages/geopandas/__init__.py:4: in <module>
    from geopandas.io.file import read_file
/home/travis/miniconda/envs/TEST/lib/python2.7/site-packages/geopandas/io/file.py:3: in <module>
    import fiona
/home/travis/miniconda/envs/TEST/lib/python2.7/site-packages/fiona/__init__.py:69: in <module>
    from fiona.collection import Collection, BytesCollection, vsi_path
/home/travis/miniconda/envs/TEST/lib/python2.7/site-packages/fiona/collection.py:9: in <module>
    from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
E   ImportError: libhdf5_cpp.so.102: cannot open shared object file: No such file or directory

This bug report suggests to uninstall and reinstall h5py: h5py/h5py#672

Ideas?

@@ -10,6 +10,7 @@ flake8-quotes
geographiclib
geopandas
gpxpy
h5py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this will fix things. I'm looking into the issue on the coda-forge side. Hold on...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, folium does not depend on h5py at all. The error is coming from fiona b/c of it links to hdf5. Please remove that line and wait a little bit as I fix the package upstream.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will revert commit.

@ocefpaf
Copy link
Member

ocefpaf commented Jun 29, 2018

Fixing the package stack will take longer than I thought.
In #900 I skip the tests that uses geopandas in the default config and we can let the 3 notebooks that also use geopandas to just fail for now.

@okomarov you'll beed to rebase after we merge #900

@ocefpaf ocefpaf mentioned this pull request Jun 29, 2018
@okomarov
Copy link
Contributor Author

@ocefpaf Thanks for looking into this. Merged upstream master into current PR.

@okomarov
Copy link
Contributor Author

okomarov commented Jun 29, 2018

So now everything passes except the notebooks that import geopandas.

@ocefpaf @Conengmo Let me know if you have additional comments or edits to add.

@ocefpaf
Copy link
Member

ocefpaf commented Jun 29, 2018

LGTM. Thanks @Conengmo for the review and @okomarov for the PR!

@ocefpaf ocefpaf merged commit b7b31aa into python-visualization:master Jun 29, 2018
@Conengmo Conengmo mentioned this pull request Jul 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants