Work done

This week I finished extending the basic GDAL WKT Raster driver code, and continued working with overviews and out-db rasters.

More specifically:

  • I solved the problem with “Invalid angle” changing srid of the data to 26711, the correct one.
  • I used a spatial query to fetch the correct block from database.
  • I created my own PQ-style array parser, to extract each element as a string.
  • I allowed raster with several bands and all pixel types, taking endianess into account

After this, I started working in adding support for reading overviews. The line executed to load raster overviews: -r utm.tif -t table -s 26711 -b 1 -k 100x100 -l 2 -V -I -M -v

Where table is the name of my raster table.

Just now, I’m working finishing the overviews code and working in the support for out-db rasters.

Planned work for next week

Finish the support for overviews and out-db rasters, and try to implement the raster inplace update.

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)),
  • I spent a lot of time implementing two methods that were implemented in GDAL :-(. These are CPLHexToBinary, in cpl_string.cpp and GDALSwapWords, from rasterio.cpp. Actually, I changed my point several times before finding these useful functions. It was a really stupid waste of time…
  • In previous versions, I transformed to binary only the raster data fetched from database, instead of the complete raster representation. This caused problems detecting the end of the data with several bands. Once changed, it worked.
  • Each band has its own pixel type, and I was considered the same pixel type for all the bands of a given raster. It worked because all the bands actually had the same pixel type, but I realized on the error testing the code and I changed it.