Rasterio: Cannot retrieve CRS from GeoTIFF file

Created on 10 Apr 2018  路  6Comments  路  Source: mapbox/rasterio

Expected behavior and actual behavior.

I want to get CRS from a GeoTIFF file but it returns None. I know that the CRS is contained in the file because gdalsrsinfo returns the following:

root@49818633db81:/datacube/original_data/S1A_IW_SLC__1SDV_20180409T070223_20180409T070249_021387_024D1C_406E.SAFE/measurement# gdalsrsinfo s1a-iw1-slc-vv-20180409t070224-20180409t070249-021387-024d1c-004.tiff 

PROJ.4 : '+proj=longlat +datum=WGS84 +no_defs '

OGC WKT :
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["unnamed",6378137,298.2572235604902,
            AUTHORITY["EPSG","4326"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]

Steps to reproduce the problem.

>>> import rasterio
>>> with rasterio.open("s1a-iw1-slc-vh-20180409t070224-20180409t070249-021387-024d1c-001.tiff") as img:
...     print(img.crs)
... 
None

Operating system

Ubuntu 16.04

Rasterio version and provenance

1.0a12 from pip 9.0.3

bug wontfix

All 6 comments

The Sentinel 1 Level 1 products do have a georeference but I think the problem here is that it cannot be represented with any projection because the images are not orthorectified.

Best to run the usual SNAP-based pre-processing first (like GEE does), which will also include terrain correction and reprojection into some well-defined CRS.

@j08lue thanks for the info.

@Fxstempfel what do you think would be the best or least surprising behavior here? A crs of None or an exception saying the georeferencing cannot be represented?

@sgillies I think an exception would be less surprising and more understandable than just None.

an exception would be less surprising and more understandable than just None

That is right, but an exception would prevent you from reading the file, even though you might know the CRS from somewhere else and could assign it manually (as e.g. in https://github.com/mapbox/rasterio/issues/859). There would be no way of getting the data out of that file with rasterio then.

That is, unless you add some kind of option to rasterio.open to disable this.

I've marked this as a bug to fix. Will not be able to do anything about it myself until after 1.0.

I'm going to close this because it was reported for version 1.0a12, and there have been a number of CRS changes since then. If it's still a problem, we can open a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

atorch picture atorch  路  3Comments

sgillies picture sgillies  路  4Comments

snowman2 picture snowman2  路  4Comments

sgillies picture sgillies  路  3Comments

lorenzori picture lorenzori  路  4Comments