Skip to content

Commit c7aaa12

Browse files
authored
pygmt.datasets.load_tile_map: Fix the rio.crs output for rasterio 1.4.2 (#3576)
1 parent edbd2a1 commit c7aaa12

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pygmt/datasets/tile_map.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,23 +126,25 @@ def load_tile_map(
126126
>>> # CRS is set only if rioxarray is available
127127
>>> if hasattr(raster, "rio"):
128128
... raster.rio.crs
129-
CRS.from_epsg(3857)
129+
CRS.from_wkt(...)
130130
"""
131131
if not _HAS_CONTEXTILY:
132-
raise ImportError(
132+
msg = (
133133
"Package `contextily` is required to be installed to use this function. "
134134
"Please use `python -m pip install contextily` or "
135135
"`mamba install -c conda-forge contextily` to install the package."
136136
)
137+
raise ImportError(msg)
137138

138139
contextily_kwargs = {}
139140
if zoom_adjust is not None:
140141
contextily_kwargs["zoom_adjust"] = zoom_adjust
141142
if Version(contextily.__version__) < Version("1.5.0"):
142-
raise TypeError(
143+
msg = (
143144
"The `zoom_adjust` parameter requires `contextily>=1.5.0` to work. "
144145
"Please upgrade contextily, or manually set the `zoom` level instead."
145146
)
147+
raise TypeError(msg)
146148

147149
west, east, south, north = region
148150
image, extent = contextily.bounds2img(

0 commit comments

Comments
 (0)