Issue with bounds2raster (contextily) using rasterio


Tony
 

Hi,

I've been using bounds2raster in contextily to save some raster tiles from OSM, but my code has started throwing up this error.  
>8--------------------------------------------------------
File "rasterio\_crs.pyx", line 327, in rasterio._crs._CRS.from_user_input
CRSError: The WKT could not be parsed. OGR Error code 6
>8--------------------------------------------------------

It worked before, so I am not sure what has changed.  I've looked around online for similar problems and haven't found anything.

I am using an Anaconda installation on Windows and have rasterio 1.0.21 and contextily 1.0rc2.

Contexily calls rasterio with the following in the tile.py file:
>8--------------------------------------------------------
    raster = rio.open(
        path,
        "w",
        driver="GTiff",
        height=h,
        width=w,
        count=b,
        dtype=str(Z.dtype.name),
        crs="epsg:3857",
        transform=transform,
    )
>8--------------------------------------------------------


The full stack trace is:
>8--------------------------------------------------------
    img, ext = ctx.bounds2raster(w, s, e, n, 'test.tif', ll=True)
 
  File "C:\ProgramData\Anaconda3\lib\site-packages\contextily\tile.py", line 117, in bounds2raster
    transform=transform,
 
  File "C:\ProgramData\Anaconda3\lib\site-packages\rasterio\env.py", line 423, in wrapper
    return f(*args, **kwds)
 
  File "C:\ProgramData\Anaconda3\lib\site-packages\rasterio\__init__.py", line 225, in open
    **kwargs)
 
  File "rasterio\_io.pyx", line 1182, in rasterio._io.DatasetWriterBase.__init__
 
  File "rasterio\_io.pyx", line 1222, in rasterio._io.DatasetWriterBase._set_crs
 
  File "C:\ProgramData\Anaconda3\lib\site-packages\rasterio\crs.py", line 434, in from_user_input
    obj._crs = _CRS.from_user_input(value, morph_from_esri_dialect=morph_from_esri_dialect)
 
  File "rasterio\_crs.pyx", line 327, in rasterio._crs._CRS.from_user_input
 
CRSError: The WKT could not be parsed. OGR Error code 6
>8--------------------------------------------------------

Do you have any ideas for me to try?

Thanks in advance,
Tony

Join main@rasterio.groups.io to automatically receive all group messages.