ERROR 1: Point outside of projection domain
See original GitHub issueDescription
I’m running also into ERROR 1: Point outside of projection domain
when using creating a RasterDataset
. The error occurs during a call torasterio.vrt.WarpedVRT
.
Bit of context: I’m warping a collection of S2 tif files. For many I’m able to warp them without exception, but for some this exception occurs. See snippets in steps to reproduce to reproduce.
Unfortunately I’m not very familar with GDAL
debugging. I hope the traceback below is sufficient to indicate where the issue might be coming from. I think it’s related to rasterio._err.CPLE_AppDefinedError: Point outside of projection domain
which points to /miniconda3/envs/torchgeo/lib/python3.10/site-packages/rasterio/_err.cpython-310-darwin.so
on my machine?. While debugging I came accross this issue which might be related.
Tracking the warning I found that the message is raised in rasterio._warp
which points on my machine I think to /Users/calkoen/miniconda3/envs/torchgeo/lib/python3.10/site-packages/rasterio/_warp.cpython-310-darwin.so
:
The warning is raised here:
self._log(INFO, msg, args) # where self is rasterio._warp
print(self) # <Logger rasterio._warp (WARNING)>
print(INFO) # 20
print(msg) # Ignoring error: err=%r
print(args) # (CPLE_AppDefinedError(3, 1, 'Point outside of projection domain'),)
The exception can be triggered by another exception:
Traceback (most recent call last):
File "rasterio/_warp.pyx", line 768, in rasterio._warp.auto_create_warped_vrt
File "rasterio/_err.pyx", line 178, in rasterio._err.exc_wrap
rasterio._err.CPLE_AppDefinedError: Point outside of projection domain
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name '_log' is not defined
Steps to reproduce
To download the data:
mkdir -p $HOME/tmp/coasttypes
cd $HOME/tmp/coasttypes
wget -O BOX_028_044_110_T18FWG_20200207T141731_B02_10m.tif https://s3.eu-central-1.amazonaws.com/floris.calkoen.open.data/coasttypes/BOX_028_044_110_T18FWG_20200207T141731_B02_10m.tif
wget -O BOX_029_371_99_T20FPH_20221002T135641_B02_10m.tif https://s3.eu-central-1.amazonaws.com/floris.calkoen.open.data/coasttypes/BOX_029_371_99_T20FPH_20221002T135641_B02_10m.tif
wget -O BOX_166_003_31_T34SEG_20220816T091559_B02_10m.tif https://s3.eu-central-1.amazonaws.com/floris.calkoen.open.data/coasttypes/BOX_166_003_31_T34SEG_20220816T091559_B02_10m.tif
To reproduce and visualize the plot using Python
import pathlib
import matplotlib.pyplot as plt
import rasterio # rasterio.__version__=='1.3.3'
import rioxarray
import xarray as xr
from torchgeo.datasets import RasterDataset # torchgeo.__version__=='0.4.0.dev0'
data_dir = pathlib.Path.home().joinpath("tmp", "coasttypes")
class Sentinel2(RasterDataset):
filename_glob = "BOX_*_T*_B02_10m.tif"
filename_regex = r"^(?P<transect>BOX_\d{3}_\d{3}_\d{1,3})_.{6}_(?P<date>\d{8}T\d{6})_(?P<band>B0[\d])"
date_format = "%Y%m%dT%H%M%S"
is_image = True
separate_files = True
all_bands = ["B02", "B03", "B04", "B08"]
rgb_bands = ["B04", "B03", "B02"]
# when only file is present in the directory the warning doesn't happen.
Sentinel2(str(data_dir))
for fp in data_dir.iterdir():
xr.open_dataset(
fp,
engine="rasterio",
)["band_data"].squeeze().plot()
plt.show()
Version
0.4.0.dev0
Issue Analytics
- State:
- Created 10 months ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
Following up on the RuntimeError above. This is caused by setting crs=CRS.from_epsg(4326) because the sampler requires the property
RandomGeoSampler.areas
, which cannot be calculated for a coordinate system (EPSG:4326), but can be calculated for a projection (EPSG:3857). Socrs=CRS.from_epsg(3857)
fixes it.Thanks for following up @FlorisCalkoen. I’m going to close this, but feel free to reach out if anything else comes up!