Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TypeError raised in add_basemap() as shown in Geopandas contextily docs #241

Open
@mtazzari

Description

When I tried to reproduce the contextily example

ax = df_wm.plot(figsize=(10, 10), alpha=0.5, edgecolor="k")
cx.add_basemap(ax, zoom=12)

on the GeoPandas website I get the same error that is visible on the docs website (see attached screenshot)

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[7], line 2
 1 ax = df_wm.plot(figsize=(10, 10), alpha=0.5, edgecolor="k")
----> 2 cx.add_basemap(ax, zoom=12)
File ~/checkouts/readthedocs.org/user_builds/geopandas/conda/latest/lib/python3.12/site-packages/contextily/plotting.py:134, in add_basemap(ax, zoom, source, interpolation, attribution, attribution_size, reset_extent, crs, resampling, zoom_adjust, **extra_imshow_args)
 130 left, right, bottom, top = _reproj_bb(
 131 left, right, bottom, top, crs, "epsg:3857"
 132 )
 133 # Download image
--> 134 image, extent = bounds2img(
 135 left, bottom, right, top, zoom=zoom, source=source, ll=False, zoom_adjust=zoom_adjust
 136 )
 137 # Warping
 138 if crs is not None:
File ~/checkouts/readthedocs.org/user_builds/geopandas/conda/latest/lib/python3.12/site-packages/contextily/tile.py:265, in bounds2img(w, s, e, n, zoom, source, ll, wait, max_retries, n_connections, use_cache, zoom_adjust)
 262 arrays = Parallel(n_jobs=n_connections, prefer=preferred_backend)(
 263 delayed(fetch_tile_fn)(tile_url, wait, max_retries) for tile_url in tile_urls)
 264 # merge downloaded tiles
--> 265 merged, extent = _merge_tiles(tiles, arrays)
 266 # lon/lat extent --> Spheric Mercator
 267 west, south, east, north = extent
File ~/checkouts/readthedocs.org/user_builds/geopandas/conda/latest/lib/python3.12/site-packages/contextily/tile.py:670, in _merge_tiles(tiles, arrays)
 668 for ind, arr in zip(indices, arrays):
 669 x, y = ind
--> 670 img[y * h : (y + 1) * h, x * w : (x + 1) * w, :] = arr
 672 bounds = np.array([mt.bounds(t) for t in tiles])
 673 west, south, east, north = (
 674 min(bounds[:, 0]),
 675 min(bounds[:, 1]),
 676 max(bounds[:, 2]),
 677 max(bounds[:, 3]),
 678 )
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

How can I fix that?
Thanks

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /