openearth / hydro-engine

Hydro Engine is a service and a command-line tool to query static and dynamic hydrographic data derived from Earth Observations
MIT License
30 stars 9 forks source link

Use local geometry for hydro-engine #13

Closed ctenvelden closed 6 years ago

ctenvelden commented 6 years ago

At the moment HydroBASINS catchments level 5 are used to clip the DEM and other rasters. It would be useful to be able to upload your own geometry instead. Possible with or without upstream function (both useful).

visr commented 6 years ago

The current interpretation of all these commands taken from the readme:

hydroengine region.json --get-catchments catchments.json
hydroengine region.json --get-rivers rivers.json
hydroengine region.json --get-raster dem dem.tif 1000 EPSG:4326
hydroengine region.json --get-lakes lakes.json
hydroengine region.json --get-lake-variable 183160 water_area area.json

Is to take the geometry in region.json, take it through get_upstream_catchments, and then return the data for the upstream area. It would be very useful to have a way to avoid get_upstream_catchments altogether, perhaps with an extra flag. Then it would just return exactly the geometry you ask for.

What do you think about that @gena? I'm not talking here about adding higher detail catchment layers to EE, I assume just skipping it would be less work as well. That way, when local catchment geometry is available, this can be used directly.

gena commented 6 years ago

Yas, I've already started refactoring the code to add extra arguments. Maybe like:

hydroengine region.json --get-rivers --catchments-filter='upstream' hydroengine region.json --get-rivers --catchments-filter='intersection'

And by default, use input region to clip features/rasters.

What do you think?

visr commented 6 years ago

I think that sounds great!

gena commented 6 years ago

... changed parameters a bit to:

hydroengine region.json --get-rivers --region-filter='region' hydroengine region.json --get-rivers --region-filter='catchments-upstream' # default (backward-compatibility) hydroengine region.json --get-rivers --region-filter='catchments-intersection'

image

We will need to re-design API to make this a bit more intuitive.