orbisgis / h2gis

A spatial extension of the H2 database.
http://www.h2gis.org
GNU Lesser General Public License v3.0
203 stars 62 forks source link

ST_D8Watershed #576

Closed ebocher closed 8 years ago

ebocher commented 8 years ago

Implement an algorithm to extract all watersheds or one based on a pixel location.

See https://grass.osgeo.org/grass64/manuals/r.watershed.html

Implement a JAI operators one to compute a watershed from a set of pixel locations the other to compute all watersheds.

The syntax will be

From pixel locations

ParameterBlock p = new ParameterBlock();
p.addSource(geoRaster); //The input raster is a D8 flow direction
p.add(Point[]);//Collection of points.
 // Run the new operator.
 RenderedOp output = JAI.create("D8Watershed", p);

All watersheds

This method needs to identify all outlets and compute the watershed for each of them.

ParameterBlock p = new ParameterBlock();
p.addSource(geoRaster); //The input raster is a D8 flow direction
 // Run the new operator.
 RenderedOp output = JAI.create("D8Watershed", p);

The ST_D8Watershed will have the following signatures


ST_D8Watershed(RASTER::TYPE) -> return a new raster with all watersheds.

ST_D8Watershed(RASTER::TYPE, MULTIPOINTS or Geometry collection') -> a set of watersheds stored in a raster with an indice.
ebocher commented 8 years ago

Note : The input raster must be grid of directions encoded according the H2GIS constants.