Add zoom_adjust parameter to pygmt.datasets.load_tile_map and Figure.tilemap#2934
Add zoom_adjust parameter to pygmt.datasets.load_tile_map and Figure.tilemap#2934
Conversation
The zoom_adjust parameter is used to adjust the automatic zoom level by integer increments. This was added in contextily=1.5.0, see geopandas/contextily#228.
pygmt/datasets/tile_map.py
Outdated
| ll=lonlat, | ||
| wait=wait, | ||
| max_retries=max_retries, | ||
| zoom_adjust=zoom_adjust, |
There was a problem hiding this comment.
Might need to make this backwards compatible with contextily<1.5.0.
There was a problem hiding this comment.
Yes, need to check the contextily version and also better to mention that the zoom_adjust parameter requires contextily>=1.5.0.
Also mention that the `zoom_adjust` parameter was added in PyGMT v0.11.0 using the versionadded sphinx directive (https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-versionadded).
pygmt/datasets/tile_map.py
Outdated
| lonlat=True, | ||
| wait=0, | ||
| max_retries=2, | ||
| zoom_adjust=None, |
There was a problem hiding this comment.
Add type hints to this newly added parameter?
| zoom_adjust=None, | |
| zoom_adjust: int | None, |
There was a problem hiding this comment.
Done at f0c95d8 for just the zoom_adjust parameter. Since all the lines are changing, should I just add type hints for all the other parameters too?
There was a problem hiding this comment.
Perfer to focus on the zoom_adjust parameter only in this PR.
pygmt/datasets/tile_map.py
Outdated
| automatically. Values outside of -1 to 1 are not recommended as they | ||
| can lead to slow execution. [Default is ``None``]. | ||
|
|
||
| .. versionadded:: 0.11.0 |
There was a problem hiding this comment.
Maybe we should not add this until PyGMT reaches v1.0.0?
.. versionadded:: 0.11.0
Fixes `error: Argument 1 to "unsignedinteger" has incompatible type "list[int]"; expected "SupportsInt | str | bytes | SupportsIndex" [arg-type]`
Co-Authored-By: Dongdong Tian <seisman.info@gmail.com>
| "to install the package." | ||
| ) | ||
|
|
||
| contextily_kwargs = {} |
There was a problem hiding this comment.
Do you want to also include zoom, source, ll, wait and max_retries in contextily_kwargs?
There was a problem hiding this comment.
Mm, not really necessary. I only made the contextily_kwargs dict to make things backwards compatible with contextily<1.5.0.
|
Gonna leave this open for another day or so in case someone wants to comment on anything. |
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>

Description of proposed changes
The
zoom_adjustparameter is used to adjust the automatic zoom level by integer increments.Preview at https://pygmt-dev--2934.org.readthedocs.build/en/2934/api/generated/pygmt.datasets.load_tile_map.html
Note: This requires
contextily>=1.5.0, see geopandas/contextily#228.Example usage:
produces
Fixes #
Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash commands are:
/format: automatically format and lint the code/test-gmt-dev: run full tests on the latest GMT development version