From 62eff2983a61b2c8c3ca6b5b1d7f03738d8d5fec Mon Sep 17 00:00:00 2001 From: Jordan Graesser Date: Sat, 9 Jul 2022 08:46:00 -0600 Subject: [PATCH] added proj translation to WKT (#1) --- stackstac/raster_spec.py | 3 ++- stackstac/rio_reader.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/stackstac/raster_spec.py b/stackstac/raster_spec.py index 2a0f190..4fc7f0e 100644 --- a/stackstac/raster_spec.py +++ b/stackstac/raster_spec.py @@ -3,6 +3,7 @@ from typing import Tuple, Union import affine +import pyproj IntFloat = Union[int, float] Bbox = Tuple[IntFloat, IntFloat, IntFloat, IntFloat] @@ -56,7 +57,7 @@ def shape(self) -> Tuple[int, int]: def vrt_params(self) -> dict: height, width = self.shape return { - "crs": self.epsg, + "crs": pyproj.CRS.from_epsg(self.epsg).to_wkt(), "transform": self.transform, "height": height, "width": width, diff --git a/stackstac/rio_reader.py b/stackstac/rio_reader.py index 226c455..f75c845 100644 --- a/stackstac/rio_reader.py +++ b/stackstac/rio_reader.py @@ -8,6 +8,7 @@ import numpy as np import rasterio as rio from rasterio.vrt import WarpedVRT +from rasterio.errors import RasterioDeprecationWarning from .rio_env import LayeredEnv from .timer import time @@ -345,7 +346,7 @@ def _open(self) -> ThreadsafeRioDataset: # Only make a VRT if the dataset doesn't match the spatial spec we want if self.spec.vrt_params != { - "crs": ds.crs.to_epsg(), + "crs": ds.crs.to_wkt(), "transform": ds.transform, "height": ds.height, "width": ds.width,