[postgis-devel] Calculating flow direction

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Fri Jul 30 13:24:07 PDT 2010


>But, did you tested the function? I'm getting a few weird values for some tests i've been running.

I did not try the function yet. however I fixed the ST_SetValue ticket. It might be related with the problem you are seeing.

>Any suggestions on how I can achieve the use case that Pierre talked about?

I see two cases:

1) You assume tiles are well aligned on the same grid and you work with raster coordinates: You find the 8 neighbour tiles one after the other by ST_Intersects them with 8 points relative to the center of the computed tile. You then arrange your math to take the neighbour tile pixels into account.

2) You don't assume tiles are well aligned and you work with world coordinates: You find every pixel value needed for your calculation using "SELECT ST_Value(rast, point) FROM foo WHERE ST_Intersect(rast, point) 8 time (accually you window is 7 pixel by 7 pixel right?) for each pixel. For sure this one should be slower but would be more general as there is no garantee in a coverage that everything is perfect, tiles are the same size and well aligned.

In both cases your function have to be aware of the name of the table to find adjacent pixels or tiles.

I would try the first one first... Should not be that complicated.

>Is it possible to union all rasters inside a single table?

Not yet but planned as ST_Union(rast)

Pierre



More information about the postgis-devel mailing list