diff --git a/app/api/tiler.py b/app/api/tiler.py index 6dde0dfa..a8d0550d 100644 --- a/app/api/tiler.py +++ b/app/api/tiler.py @@ -138,18 +138,21 @@ class Metadata(TaskNestedView): info = main.metadata(raster_path, pmin=pmin, pmax=pmax, histogram_bins=255, expr=expr) cmap_labels = { - 'jet_r': 'Jet', + "jet_r": "Jet", "terrain_r": "Terrain", - "rdylgn": "Index", - "spectral_r": "Spectral", + "gist_earth_r": "Earth", + "rdylgn": "RdYlGn", + "rdylgn_r": "RdYlGn (Reverse)", + "spectral": "Spectral", + "spectral_r": "Spectral (Reverse)", "pastel1_r": "Pastel", } colormaps = [] if tile_type in ['dsm', 'dtm']: - colormaps = ['jet_r', 'terrain_r', 'spectral_r', 'pastel1_r'] + colormaps = ['jet_r', 'terrain_r', 'gist_earth_r', 'pastel1_r'] elif formula and bands: - colormaps = ['rdylgn'] + colormaps = ['rdylgn', 'spectral', 'rdylgn_r', 'spectral_r'] info['algorithms'] = get_algorithm_list(), info['filters'] = get_camera_filters_list() @@ -231,7 +234,7 @@ class Tiles(TaskNestedView): if bands == '': bands = None if rescale == '': rescale = None if color_map == '': color_map = None - if hillshade == '': hillshade = None + if hillshade == '' or hillshade == '0': hillshade = None expr = lookup_formula(formula, bands) diff --git a/app/static/app/js/components/LayersControlLayer.jsx b/app/static/app/js/components/LayersControlLayer.jsx index 5c2de034..ef490bd4 100644 --- a/app/static/app/js/components/LayersControlLayer.jsx +++ b/app/static/app/js/components/LayersControlLayer.jsx @@ -35,7 +35,7 @@ export default class LayersControlLayer extends React.Component { hillshade: params.hillshade || "", }; - this.rescale = ""; + this.rescale = params.rescale || ""; } getLayerUrl = () => { @@ -52,6 +52,10 @@ export default class LayersControlLayer extends React.Component { this.map.removeLayer(layer); } } + + if (prevState.hillshade !== this.state.hillshade){ + this.updateLayer(); + } } handleLayerClick = () => { @@ -63,6 +67,10 @@ export default class LayersControlLayer extends React.Component { this.setState({colorMap: e.target.value}); } + handleSelectHillshade = e => { + this.setState({hillshade: e.target.value}); + } + updateLayer = () => { if (this.updateTimer){ clearTimeout(this.updateTimer); @@ -81,7 +89,7 @@ export default class LayersControlLayer extends React.Component { formula, bands, hillshade, - rescale: encodeURIComponent(this.rescale) + rescale: this.rescale }); const { layer } = this.props; @@ -102,7 +110,7 @@ export default class LayersControlLayer extends React.Component { } render(){ - const { colorMap } = this.state; + const { colorMap, hillshade } = this.state; const { meta, tmeta } = this; const { color_maps } = tmeta; @@ -131,6 +139,18 @@ export default class LayersControlLayer extends React.Component { : ""} + + {hillshade !== "" ? +
+ +
+ +
+
: ""} : ""} );