[x] implement subsetting by bounding box (leaflet-coverage)
[x] implement masking by polygon (leaflet-coverage)
[x] add support for MultiPolygon in masking (leaflet-coverage)
[x] integrate into demo portal
Implementation plan
Filtering a grid by a polygon can be seen as a two-step process. Step 1 is to subset the grid by the bounding box of the polygon. Step 2 is to mask all grid cells outside the polygon. The result is a grid coverage on which further processing like statistics can be done. Any data outside the polygon would then be regarded as missing data.
Subsetting by bounding box and masking by polygon are currently implemented in the leaflet-coverage library, however as these operations are independent of the use of leaflet, they should be extracted into a separate library once more such processing functions are implemented.
The polygon (including MultiPolygon) itself comes from a GeoJSON document. When the user clicks "Subset" on the distribution to be subsetted he gets a listing of available GeoJSON distributions within the workspace. After selecting one of those, the GeoJSON is inspected and checked how many polygons it includes. If it contains only a single polygon, then this is chosen. If more are available, they are drawn on the map and the user has to choose one by clicking on it.
Description: Wiki
Libraries to be used:
Tasks to be finished:
Implementation plan
Filtering a grid by a polygon can be seen as a two-step process. Step 1 is to subset the grid by the bounding box of the polygon. Step 2 is to mask all grid cells outside the polygon. The result is a grid coverage on which further processing like statistics can be done. Any data outside the polygon would then be regarded as missing data.
Subsetting by bounding box and masking by polygon are currently implemented in the leaflet-coverage library, however as these operations are independent of the use of leaflet, they should be extracted into a separate library once more such processing functions are implemented.
The polygon (including MultiPolygon) itself comes from a GeoJSON document. When the user clicks "Subset" on the distribution to be subsetted he gets a listing of available GeoJSON distributions within the workspace. After selecting one of those, the GeoJSON is inspected and checked how many polygons it includes. If it contains only a single polygon, then this is chosen. If more are available, they are drawn on the map and the user has to choose one by clicking on it.
A test set can be found here: https://raw.githubusercontent.com/chrisfinch/over9k/master/public/experiments/march-2013/GBR_adm2.json