Work done

This week:

  • I implemented access to overviews, adding overviews tables as subdatasets of the general dataset, and adding metadata info to SUBDATASETS domain.
  • I implemented raster inplace update, bt overwriting the IWriteBlock method of RasterBand.
  • I reorganized some parts of the code by creating RasterWrapper and RasterBandWrapper classes. In these classes, I do all the tasks related with raster format: parse hexwkb format, swap words with needed, get and set raster attributes, etc.  The WKTRasterWrapper takes the hexwkb string fetched from database, and fill raster properties by parsing it. The most useful thing, in my opinion, is that in any moment, you can get the updated hexwkb representation of the raster again.  The WKTRasterBandWrapper allows setting new data for the band.
  • I implemented a TODO task of the gdal2wktraster script: support from out-db rasters. My version of the script has been sent for review to PostGIS devel list.

The two last tasks will help me in the implementation of support for out-db rasters in the driver

Planned work for next week

  • Finish support for out-db rasters.  I asked Mateusz for this option in the loader script, and he told me to implement it, if I wanted. I need this option for adding out-db support in the driver.
  • Correct errors. This is a transversal task. This week I found a couple of important errors in several parts of the code.
  • Update RASTER_COLUMNS table with the information fetched in IReadBlock, if needed. This was an old doubt, and I think that’s the correct point, thanks to a Frank’s comment.
  • Start with block caching. In each call to IReadBlock, I fetch all the raster from database.

Problems found

  • The spatial query seems to work, but I’m not sure if is the most appropiate:
    • With GIST index:
      SELECT rast  FROM table WHERE rast ~ ST_SetSRID(ST_MakeBox2D(
      ST_Point(lowerLeftX, lowerLeftY) ,ST_Point(upperRightX, upperRightY)),
    • Without GIST index:
      SELECT rast  FROM table WHERE _ST_Contains(rast, ST_SetSRID(ST_MakeBox2D(
      ST_Point(lowerLeftX, lowerLeftY) ,ST_Point(upperRightX, upperRightY)),
  • When calculating a block  Bounding Box based on a block offset and the block size in IReadBlock, I crossed two values (X-Y), and, of course, it failed for non-square blocks. I spent a couple of days with this error
  • DOUBT: What happens if the bb of a block offset in IReadBlock doesn’t match any real block? Missing-tiles raster?
  • DOUBT: Where should I fit WKTRaster “16BF” datatype? In GDT_Uint16?, in a single float?