|
1 | 1 | """Tools for generating maps from a text search.""" |
| 2 | + |
2 | 3 | import geopy as gp |
3 | 4 | import numpy as np |
4 | 5 | import matplotlib.pyplot as plt |
5 | | -import warnings |
6 | 6 |
|
7 | | -from .tile import howmany, bounds2raster, bounds2img, _sm2ll, _calculate_zoom |
| 7 | +from .tile import howmany, bounds2raster, bounds2img, _calculate_zoom |
8 | 8 | from .plotting import INTERPOLATION, ZOOM, add_attribution |
9 | 9 | from . import providers |
10 | 10 | from xyzservices import TileProvider |
@@ -214,65 +214,3 @@ def __repr__(self): |
214 | 214 | self.place, self.n_tiles, self.zoom, self.im.shape[:2] |
215 | 215 | ) |
216 | 216 | return s |
217 | | - |
218 | | - |
219 | | -def plot_map( |
220 | | - place, bbox=None, title=None, ax=None, axis_off=True, latlon=True, attribution=None |
221 | | -): |
222 | | - """Plot a map of the given place. |
223 | | -
|
224 | | - Parameters |
225 | | - ---------- |
226 | | - place : instance of Place or ndarray |
227 | | - The map to plot. If an ndarray, this must be an image corresponding |
228 | | - to a map. If an instance of ``Place``, the extent of the image and name |
229 | | - will be inferred from the bounding box. |
230 | | - ax : instance of matplotlib Axes object or None |
231 | | - The axis on which to plot. If None, one will be created. |
232 | | - axis_off : bool |
233 | | - Whether to turn off the axis border and ticks before plotting. |
234 | | - attribution : str |
235 | | - [Optional. Default to standard `ATTRIBUTION`] Text to be added at the |
236 | | - bottom of the axis. |
237 | | -
|
238 | | - Returns |
239 | | - ------- |
240 | | - ax : instance of matplotlib Axes object or None |
241 | | - The axis on the map is plotted. |
242 | | - """ |
243 | | - warnings.warn( |
244 | | - ( |
245 | | - "The method `plot_map` is deprecated and will be removed from the" |
246 | | - " library in future versions. Please use either `add_basemap` or" |
247 | | - " the internal method `Place.plot`" |
248 | | - ), |
249 | | - DeprecationWarning, |
250 | | - ) |
251 | | - if not isinstance(place, Place): |
252 | | - im = place |
253 | | - bbox = bbox |
254 | | - title = title |
255 | | - else: |
256 | | - im = place.im |
257 | | - if bbox is None: |
258 | | - bbox = place.bbox_map |
259 | | - if latlon is True: |
260 | | - # Convert w, s, e, n into lon/lat |
261 | | - w, e, s, n = bbox |
262 | | - w, s = _sm2ll(w, s) |
263 | | - e, n = _sm2ll(e, n) |
264 | | - bbox = [w, e, s, n] |
265 | | - |
266 | | - title = place.place if title is None else title |
267 | | - |
268 | | - if ax is None: |
269 | | - fig, ax = plt.subplots(figsize=(15, 15)) |
270 | | - ax.imshow(im, extent=bbox) |
271 | | - ax.set(xlabel="X", ylabel="Y") |
272 | | - if title is not None: |
273 | | - ax.set(title=title) |
274 | | - if attribution: |
275 | | - add_attribution(ax, attribution) |
276 | | - if axis_off is True: |
277 | | - ax.set_axis_off() |
278 | | - return ax |
0 commit comments