I tried to make raster file with GTiff format by using python GDAL, this is my sample gdal logic:
driver = gdal.GetDriverByName('GTiff')
outRaster = driver.Create(raster_classified, col, row, 1, gdal.GDT_Int16)
outRaster.SetGeoTransform((origin_x, cell_size, 0, origin_y - (cell_size * row), 0, cell_size))
outband = outRaster.GetRasterBand(1)
outband.WriteArray(outras_array[::-1])
outRasterSRS = osr.SpatialReference()
outRasterSRS.ImportFromEPSG(4326)
outRaster.SetProjection(outRasterSRS.ExportToWkt())
outband.FlushCache()
But after the raster file was created.. it's return with VRT format.. why? This is the raster properties :
Driver
GDAL provider
VRT
Virtual Raster
Dataset Description
Band 1
STATISTICS_MAXIMUM=9
STATISTICS_MEAN=0.99751150063449
STATISTICS_MINIMUM=0
STATISTICS_STDDEV=2.3322020706147
Dimensions
X: 6500 Y: 4500 Bands: 1
Origin
110.5,-4.5
Pixel Size
0.001,-0.001
No Data Value
*NoDataValue not set*
Data Type
Int16 - Sixteen bit signed integer
Pyramid overviews
Layer Spatial Reference System
+proj=longlat +datum=WGS84 +no_defs
Layer Extent (layer original source projection)
110.5000000000000000,-9.0000000000000000 : 117.0000000000000000,-4.5000000000000000
Band
Band 1
Band No
1
No Stats
No stats collected yet
how to make geotiff format with python GDAL?
raster_classified
ends in '.tif'? Doesraster_classified
already exist? If so, delete it and try it again.