python: perform gdalwarp in memory with gdal bindings

扶醉桌前 提交于 2019-12-05 10:09:52

If you want to mimic your "reference" call to gdalwarp you can use:

import gdal

ds = gdal.Warp('warp_test.tif', infile, dstSRS='EPSG:4326',
               outputType=gdal.GDT_Int16, xRes=0.00892857142857143, yRes=0.00892857142857143)
ds = None

If you dont want to output to a file on disk, you can warp to an in-memory VRT file, for example:

ds = gdal.Warp('', infile, dstSRS='EPSG:4326', format='VRT',
               outputType=gdal.GDT_Int16, xRes=0.00892857142857143, yRes=0.00892857142857143)

You can of course warp to any format in memory, but for files other than VRT the warped result will actually be stored in-memory.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!