I'd like to create a PostGIS raster using GDAL and python.
I can get the driver easily:
drv = gdal.GetDriverByName("PostGISRaster")
But how can I create a new raster table? I can't find any information about drv.Create
to explain what to put there….?
Best Answer
It looks like the ability to create rasters is not yet available in the driver. However, you can create a layer using your standard PostgreSQL Python driver (i.e. psycopg2) and then open it from GDAL.
So you'd create a layer using ST_MakeEmptyRaster and ST_AddBand:
Then you'd open and manipulate the raster in GDAL/Python
I haven't tested this extensively yet, but it
seems to work.doesn't work at all. I get the error,when I try to write.
You could use Python and psycopg2 to write chunks of your image to a raster table using ST_SetValues.