rasterize¶
-
museotoolbox.processing.
rasterize
(in_image, in_vector, in_field=False, out_image='MEM', gdt=3, invert=False)[source]¶ Rasterize vector to the size of data (raster)
- Parameters
in_image (str.) – A filename or path corresponding to a raster image.
in_vector (str.) – A filename or path corresponding to a vector file.
in_field (str, optional (default=False)) – Name of the filed to rasteirze. If False, will rasterize the polygons or points with >0 value, and set the other values to 0.
out_image (str, optional (default = 'MEM')) – A filename or path corresponding to a geotiff (.tif) raster image to save. ‘MEM’ will store raster in memory.
gdt (int, optional (default=gdal.GDT_Int16)) – gdal datatype.
invert (bool, optional (default=False)) – if invert is True, polygons will have 0 values in the out_image.
- Returns
dst_ds – The open dataset with gdal (essential if out_image is set to ‘MEM’)
- Return type
gdal object