From 223033b784017f234d0df657467d95f189c08418 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 5 Nov 2019 17:07:40 -0500 Subject: [PATCH] VARI index POC --- app/api/tiler.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/api/tiler.py b/app/api/tiler.py index 3dbb87da..415e75de 100644 --- a/app/api/tiler.py +++ b/app/api/tiler.py @@ -139,6 +139,12 @@ class Tiles(TaskNestedView): if rescale is None: rescale = '157.0500,164.850' + if tile_type == 'orthophoto': + expr = '(b2-b1)/(b2+b1-b3)' + rescale = "0.02,0.1" + #color_formula = 'b1' + color_map = 'rdylgn' + if nodata is not None: nodata = numpy.nan if nodata == "nan" else float(nodata) tilesize = scale * 256 @@ -162,7 +168,10 @@ class Tiles(TaskNestedView): ) if color_map: - color_map = get_colormap(color_map, format="gdal") + try: + color_map = get_colormap(color_map, format="gdal") + except FileNotFoundError: + raise exceptions.ValidationError("Not a valid color_map value") options = img_profiles.get(driver, {}) return HttpResponse(