I have a raster table in PostGIS. When I run ST_SetValue(rast, geom , value) on it to change the pixel value at a point, it works very slowly. Do you know how can I create spatial index for a raster column? (I could not create it using PgAdmin interface with gist method)
-
1Did you tile your raster? It makes a big difference to pixel access speeds and spatial search in general. – John Powell Jul 12 '19 at 16:36
-
1Usually, for rasters, you tile the bounding box of each tile, even though mutliple tiles constitute a complete coverage. Obviously, indexing each pixel is pointless and indexing the bounding box of the raster is pointless, but indexing each sub-tile of the raster will make this a lot quicker, as you have to open much fewer points before you can run ST_SetValue. See this answer, for example. – John Powell Jul 15 '19 at 11:21
-
or this one: gis.stackexchange.com/questions/43053/… – John Powell Jul 15 '19 at 11:25
So when you are using raster2pgsql raster_options_go_here raster_file someschema.sometable > out.sql
, use -I
tag, that will create a GiST index on the raster column.
For more go here here