Skip to content

Commit

Permalink
pygmt.datasets.load_tile_map: Fix the rio.crs output for rasterio 1.4…
Browse files Browse the repository at this point in the history
….2 (#3576)
  • Loading branch information
seisman authored Nov 4, 2024
1 parent edbd2a1 commit c7aaa12
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pygmt/datasets/tile_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,23 +126,25 @@ def load_tile_map(
>>> # CRS is set only if rioxarray is available
>>> if hasattr(raster, "rio"):
... raster.rio.crs
CRS.from_epsg(3857)
CRS.from_wkt(...)
"""
if not _HAS_CONTEXTILY:
raise ImportError(
msg = (
"Package `contextily` is required to be installed to use this function. "
"Please use `python -m pip install contextily` or "
"`mamba install -c conda-forge contextily` to install the package."
)
raise ImportError(msg)

contextily_kwargs = {}
if zoom_adjust is not None:
contextily_kwargs["zoom_adjust"] = zoom_adjust
if Version(contextily.__version__) < Version("1.5.0"):
raise TypeError(
msg = (
"The `zoom_adjust` parameter requires `contextily>=1.5.0` to work. "
"Please upgrade contextily, or manually set the `zoom` level instead."
)
raise TypeError(msg)

west, east, south, north = region
image, extent = contextily.bounds2img(
Expand Down

0 comments on commit c7aaa12

Please sign in to comment.