def get_crs(self): """ Returns the CRS associated with this dataset. If none is found the default for the session is returned :rtype: str """ import osgeo.osr as osr wkt = self.gdal_dataset.GetProjection() spatial_ref = osr.SpatialReference() spatial_ref.ImportFromWkt(wkt) crs = ConfigManager.default_crs if spatial_ref.GetAuthorityName(None) is not None: crs = CRSUtil.get_crs_url(spatial_ref.GetAuthorityName(None), spatial_ref.GetAuthorityCode(None)) return crs
def get_crs(self): """ Returns the CRS associated with this dataset. If none is found the default for the session is returned :rtype: str """ wkt = self.gdal_dataset.GetProjection() spatial_ref = self._get_spatial_ref(wkt) crs = ConfigManager.default_crs if spatial_ref.GetAuthorityName(None) is not None: crs = CRSUtil.get_crs_url(spatial_ref.GetAuthorityName(None), spatial_ref.GetAuthorityCode(None)) if crs is None: raise RuntimeException("Cannot implicitly detect EPSG code from WKT of input file. " "Please explicitly specify the CRS in the ingredient (option \"default_crs\").") return crs