gdal 2.1 Rasterize

后端 未结 2 1684
臣服心动
臣服心动 2021-01-19 19:55

Is it possible to set the data type (Byte, Float32) when using gdal.Rasterize in gdal 2.1? Currently, I use gdal.Translate to convert to Byte, but this is inefficient.

相关标签:
2条回答
  • 2021-01-19 20:45

    If you are in gdal 2.1.2, use gdal.RasterizeOptions() as if you were using it on the command line:

    opts_str = '-ot Byte'
    rast_opts = gdal.RasterizeOptions(options=opts_str)
    
    0 讨论(0)
  • 2021-01-19 20:49

    This has been fixed in GDAL 2.1.3. Previously the data type was hard-coded and not exposed in the Python bindings. See https://trac.osgeo.org/gdal/ticket/6710.

    0 讨论(0)
提交回复
热议问题