Rasterio: example of reprojection in the docs throws exception

Created on 18 Nov 2019  路  2Comments  路  Source: mapbox/rasterio

This does not seem to work for me. I copied the reproject example in the docs and I get:

TypeError Traceback (most recent call last)
in
32 dst_transform=dst_transform,
33 dst_crs=dst_crs,
---> 34 resampling=Resampling.nearest)
35
36 # Assert that the destination is only partly filled.

~\Anaconda3\lib\site-packages\rasterio\env.py in wrapper(args, *kwds)
392 def wrapper(args, *kwds):
393 if local._env:
--> 394 return f(args, *kwds)
395 else:
396 with Env.from_defaults():

~\Anaconda3\lib\site-packages\rasterio\env.py in wrapper(args, *kwds)
618 param, full_kwds[param], inequality, version, reason))
619
--> 620 return f(args, *kwds)
621
622 return wrapper

~\Anaconda3\lib\site-packages\rasterio\warp.py in reproject(source, destination, src_transform, gcps, src_crs, src_nodata, dst_transform, dst_crs, dst_nodata, dst_resolution, src_alpha, dst_alpha, resampling, num_threads, init_dest_nodata, warp_mem_limit, *kwargs)
345 src_alpha=src_alpha, resampling=resampling,
346 init_dest_nodata=init_dest_nodata, num_threads=num_threads,
--> 347 warp_mem_limit=warp_mem_limit, *
kwargs)
348
349 return destination, dst_transform

rasterio_warp.pyx in rasterio._warp._reproject()

rasterio_warp.pyx in rasterio._warp._reproject()

rasterio_warp.pyx in rasterio._warp._reproject.format_transform()

~\Anaconda3\lib\site-packages\rasterio\transform.py in guard_transform(transform)
89 if tastes_like_gdal(transform):
90 raise TypeError(
---> 91 "GDAL-style transforms have been deprecated. This "
92 "exception will be raised for a period of time to highlight "
93 "potentially confusing errors, but will eventually be removed.")

TypeError: GDAL-style transforms have been deprecated. This exception will be raised for a period of time to highlight potentially confusing errors, but will eventually be removed.

bug docs

All 2 comments

I think this is related to this topic: Migrating to Rasterio 1.0
https://github.com/mapbox/rasterio/blob/master/docs/topics/migrating-to-v1.rst

So, following the Reprojection example of the rasterio web page, the GDAL-style geotransforms:

#(c, a, b, f, d, e)
dst_transform = [-237481.5, 425.0, 0.0, 237536.4, 0.0, -425.0]

has to be changed by the affine.Affine() form:

#affine.Affine(a, b, c,
#              d, e, f)

from rasterio import Affine as A
dst_transform = A(425.0, 0.0, -237481.5,
                   0.0, -425.0, 237536.4,)

and so it works. This is useful until the website is updated.

Docs are rebuilding now, should be only a few minutes until the "latest" docs are re-built. The "stable" docs won't be updated until we have a 1.1.4 release.

Was this page helpful?
0 / 5 - 0 ratings