当前位置: 首页>>代码示例>>Python>>正文


Python const.GDAL_RESAMPLE_ALGORITHMS属性代码示例

本文整理汇总了Python中django.contrib.gis.gdal.raster.const.GDAL_RESAMPLE_ALGORITHMS属性的典型用法代码示例。如果您正苦于以下问题:Python const.GDAL_RESAMPLE_ALGORITHMS属性的具体用法?Python const.GDAL_RESAMPLE_ALGORITHMS怎么用?Python const.GDAL_RESAMPLE_ALGORITHMS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在django.contrib.gis.gdal.raster.const的用法示例。


在下文中一共展示了const.GDAL_RESAMPLE_ALGORITHMS属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: transform

# 需要导入模块: from django.contrib.gis.gdal.raster import const [as 别名]
# 或者: from django.contrib.gis.gdal.raster.const import GDAL_RESAMPLE_ALGORITHMS [as 别名]
def transform(self, srid, driver=None, name=None, resampling='NearestNeighbour',
                  max_error=0.0):
        """
        Returns a copy of this raster reprojected into the given SRID.
        """
        # Convert the resampling algorithm name into an algorithm id
        algorithm = GDAL_RESAMPLE_ALGORITHMS[resampling]

        # Instantiate target spatial reference system
        target_srs = SpatialReference(srid)

        # Create warped virtual dataset in the target reference system
        target = capi.auto_create_warped_vrt(
            self._ptr, self.srs.wkt.encode(), target_srs.wkt.encode(),
            algorithm, max_error, c_void_p()
        )
        target = GDALRaster(target)

        # Construct the target warp dictionary from the virtual raster
        data = {
            'srid': srid,
            'width': target.width,
            'height': target.height,
            'origin': [target.origin.x, target.origin.y],
            'scale': [target.scale.x, target.scale.y],
            'skew': [target.skew.x, target.skew.y],
        }

        # Set the driver and filepath if provided
        if driver:
            data['driver'] = driver

        if name:
            data['name'] = name

        # Warp the raster into new srid
        return self.warp(data, resampling=resampling, max_error=max_error) 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:39,代码来源:source.py


注:本文中的django.contrib.gis.gdal.raster.const.GDAL_RESAMPLE_ALGORITHMS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。