[postgis-users] Storage of tile offset on a raster dataset

jramm james.ramm at jbarisk.com
Tue Jan 19 00:07:13 PST 2016


When importing a large raster dataset, it is typically tiled and the only
reference in postgis that these tiles form a single dataset is the
raster_columns table. 
I'd like postgis to keep track of the tile offsets (from upper left to lower
right) as I believe this should bring about performance improvements by
reducing geometric operations to simple scaling laws. The tile offset could
be stored as a linear index for simplicity.

Consider trying to locate which tile in a dataset a point lies within. You
can calculate the tile offset in x and y with the following scaling law:



Where ulx & uly are the upper left coordinates of the raster dataset (i.e.
the upper left coordinates of tile 0). 

When loading multiple datasets of the same extent (e.g. temporal datasets or
implementing rudimentary version control), you could easily discover all
tiles for a single location. 
Other use-cases where I think this would be of benefit:

   - Finding the height profile along a line (you can quickly locate which
tiles cover the line with the start and end coordinates and load them into
memory for the rest of the processing)
   - Checking alignment of tiles. This is especially important when loading
multiple datasets which should be aligned. Lets say I load 1 'base' dataset
which gets tiled on the way in. Any subsequent tiles I load (e.g. to update
a region of the dataset) need to be aligned. I can check that my input tile
has the same corner coordinates of the tile it is replacing by calculating
the tile index and pulling out the relevant information. 
    - Iterating a raster dataset. Especially important when the processing
you are doing is order-dependent (such as sequential neighbourhood searches
(for e.g. terrain processing,  or imposing boundary conditions)

To my mind, this seems quicker than the 'normal' method of doing something
like



Are there any facilities in postgis to support this already? Or am I
overlooking some concepts about postgis that mean the above is unnecessary
(i.e. the use cases can be met with no performance hit)

My current solution would be to add a  column to each row. This would then
require modification to e.g. raster2pgsql on my part in order to populate
that column for each tile that is loaded.




--
View this message in context: http://postgis.17.x6.nabble.com/Storage-of-tile-offset-on-a-raster-dataset-tp5009592.html
Sent from the PostGIS - User mailing list archive at Nabble.com.


More information about the postgis-users mailing list