File tree 1 file changed +3
-24
lines changed
1 file changed +3
-24
lines changed Original file line number Diff line number Diff line change 9
9
from pygmt .helpers import build_arg_list , fmt_docstring , kwargs_to_strings , use_alias
10
10
11
11
try :
12
- import rioxarray # noqa: F401
13
12
from xyzservices import TileProvider
14
-
15
- _HAS_RIOXARRAY = True
16
13
except ImportError :
17
14
TileProvider = None
18
- _HAS_RIOXARRAY = False
19
15
20
16
21
17
@fmt_docstring
@@ -111,38 +107,21 @@ def tilemap(
111
107
112
108
kwargs : dict
113
109
Extra keyword arguments to pass to :meth:`pygmt.Figure.grdimage`.
114
-
115
- Raises
116
- ------
117
- ImportError
118
- If ``rioxarray`` is not installed. Follow
119
- :doc:`install instructions for rioxarray <rioxarray:installation>`, (e.g. via
120
- ``python -m pip install rioxarray``) before using this function.
121
110
"""
122
111
kwargs = self ._preprocess (** kwargs )
123
112
124
- if not _HAS_RIOXARRAY :
125
- raise ImportError (
126
- "Package `rioxarray` is required to be installed to use this function. "
127
- "Please use `python -m pip install rioxarray` or "
128
- "`mamba install -c conda-forge rioxarray` to install the package."
129
- )
130
-
131
113
raster = load_tile_map (
132
114
region = region ,
133
115
zoom = zoom ,
134
116
source = source ,
135
117
lonlat = lonlat ,
118
+ crs = "OGC:CRS84" if lonlat is True else "EPSG:3857" ,
136
119
wait = wait ,
137
120
max_retries = max_retries ,
138
121
zoom_adjust = zoom_adjust ,
139
122
)
140
-
141
- # Reproject raster from Spherical Mercator (EPSG:3857) to lonlat (OGC:CRS84) if
142
- # bounding box region was provided in lonlat
143
- if lonlat and raster .rio .crs == "EPSG:3857" :
144
- raster = raster .rio .reproject (dst_crs = "OGC:CRS84" )
145
- raster .gmt .gtype = 1 # set to geographic type
123
+ if lonlat :
124
+ raster .gmt .gtype = 1 # Set to geographic type
146
125
147
126
# Only set region if no_clip is None or False, so that plot is clipped to exact
148
127
# bounding box region
You can’t perform that action at this time.
0 commit comments