Я новичок в обработке пространственных данных в Python с использованием растерио, и я работал с примерами. У меня проблемы с деформацией, даже с примерами доступных наборов данных, и я не уверен, где отсюда go. Ниже приведен код, который я выполнял (непосредственно из документации по растерио) и ошибка, которую я получал.
from affine import Affine
import mercantile
import rasterio
from rasterio.enums import Resampling
from rasterio.vrt import WarpedVRT
with rasterio.open('RGB.byte.tif') as src:
with WarpedVRT(src, crs='EPSG:3857',
resampling=Resampling.bilinear) as vrt:
# Determine the destination tile and its mercator bounds using
# functions from the mercantile module.
dst_tile = mercantile.tile(*vrt.lnglat(), 9)
left, bottom, right, top = mercantile.xy_bounds(*dst_tile)
# Determine the window to use in reading from the dataset.
dst_window = vrt.window(left, bottom, right, top)
# Read into a 3 x 512 x 512 array. Our output tile will be
# 512 wide x 512 tall.
data = vrt.read(window=dst_window, out_shape=(3, 512, 512))
# Use the source's profile as a template for our output file.
profile = vrt.profile
profile['width'] = 512
profile['height'] = 512
profile['driver'] = 'GTiff'
# We need determine the appropriate affine transformation matrix
# for the dataset read window and then scale it by the dimensions
# of the output array.
dst_transform = vrt.window_transform(dst_window)
scaling = Affine.scale(dst_window.num_cols / 512,
dst_window.num_rows / 512)
dst_transform *= scaling
profile['transform'] = dst_transform
# Write the image tile to disk.
with rasterio.open('/tmp/test-tile.tif', 'w', **profile) as dst:
dst.write(data)
CPLE_BaseError Traceback (most recent call last)
rasterio/_crs.pyx in rasterio._crs._CRS.from_user_input()
rasterio/_err.pyx in rasterio._err.exc_wrap_ogrerr()
CPLE_BaseError: OGR Error code 6
During handling of the above exception, another exception occurred:
CRSError Traceback (most recent call last)
<ipython-input-26-764b8370d990> in <module>
8 with rasterio.open('RGB.byte.tif') as src:
9 with WarpedVRT(src, crs='EPSG:3857',
---> 10 resampling=Resampling.bilinear) as vrt:
11
12 # Determine the destination tile and its mercator bounds using
rasterio/_warp.pyx in rasterio._warp.WarpedVRTReaderBase.__init__()
~/opt/anaconda3/envs/tensorflow/lib/python3.6/site-packages/rasterio/crs.py in
from_user_input(cls, value, morph_from_esri_dialect)
457 elif isinstance(value, string_types):
458 obj = cls()
--> 459 obj._crs = _CRS.from_user_input(value,
morph_from_esri_dialect=morph_from_esri_dialect)
460 return obj
461 else:
rasterio/_crs.pyx in rasterio._crs._CRS.from_user_input()
CRSError: The WKT could not be parsed. OGR Error code 6