コード例 #1
0
    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
コード例 #2
0
ファイル: gdal_util.py プロジェクト: akarmas/rasdaman
    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
コード例 #3
0
 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