本文整理匯總了Python中osgeo.gdal.AutoCreateWarpedVRT方法的典型用法代碼示例。如果您正苦於以下問題:Python gdal.AutoCreateWarpedVRT方法的具體用法?Python gdal.AutoCreateWarpedVRT怎麽用?Python gdal.AutoCreateWarpedVRT使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類osgeo.gdal
的用法示例。
在下文中一共展示了gdal.AutoCreateWarpedVRT方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: reproject_dataset
# 需要導入模塊: from osgeo import gdal [as 別名]
# 或者: from osgeo.gdal import AutoCreateWarpedVRT [as 別名]
def reproject_dataset(from_dataset, from_srs, to_srs, options=None):
"""
Returns the input dataset in the expected "destination" SRS.
If the dataset is already in the correct SRS, returns it unmodified
"""
if not from_srs or not to_srs:
raise GDALError("from and to SRS must be defined to reproject the dataset")
if (from_srs.ExportToProj4() != to_srs.ExportToProj4()) or (from_dataset.GetGCPCount() != 0):
to_dataset = gdal.AutoCreateWarpedVRT(from_dataset,
from_srs.ExportToWkt(), to_srs.ExportToWkt())
if options and options.verbose:
print("Warping of the raster by AutoCreateWarpedVRT (result saved into 'tiles.vrt')")
to_dataset.GetDriver().CreateCopy("tiles.vrt", to_dataset)
return to_dataset
else:
return from_dataset