Skip to content

Commit

Permalink
Merge pull request #578 from EOxServer/raster-style-bugfix
Browse files Browse the repository at this point in the history
fix: fix bug with rasterstyle and browse_range
  • Loading branch information
jankovicgd authored Dec 5, 2024
2 parents 959b8fb + d441877 commit 9f2d98e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions eoxserver/render/mapserver/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from eoxserver.contrib import mapserver as ms
from eoxserver.contrib import vsi, vrt, gdal, osr, ogr
from eoxserver.render.browse.objects import (
Browse, GeneratedBrowse, BROWSE_MODE_GRAYSCALE, BROWSE_MODE_RGBA
Browse, GeneratedBrowse, BROWSE_MODE_GRAYSCALE, BROWSE_MODE_RGBA, RasterStyle
)
from eoxserver.render.browse.generate import (
generate_browse, FilenameGenerator
Expand All @@ -54,6 +54,7 @@
Layer, Map,
)
from eoxserver.render.coverage.objects import Coverage, Field

from eoxserver.render.mapserver.config import (
DEFAULT_EOXS_MAPSERVER_HEATMAP_RANGE_DEFAULT,
DEFAULT_EOXS_MAPSERVER_HEATMAP_STYLE_DEFAULT,
Expand Down Expand Up @@ -347,7 +348,7 @@ def destroy(self, map_obj, layer, data):
class BrowseLayerMixIn(object):
def make_browse_layer_generator(self, map_obj, browses, map_,
filename_generator, group_name, ranges,
style):
style: str):
for browse in browses:
if isinstance(browse, GeneratedBrowse):
creation_info, filename_generator, reset_info = \
Expand Down Expand Up @@ -423,7 +424,7 @@ def make_browse_layer_generator(self, map_obj, browses, map_,

for layer_obj in layer_objs:
_create_raster_style(
style or "blackwhite", layer_obj,
DEFAULT_RASTER_STYLES[style or "blackwhite"], layer_obj,
browse_range[0], browse_range[1],
browse.nodata_values
)
Expand All @@ -432,8 +433,8 @@ def make_browse_layer_generator(self, map_obj, browses, map_,
# final LUT for min,max 200,700 and nodata=0 should look like:
# 0:0,1:1,200:1,700:256
lut_inputs = {
range_[0]: 1,
range_[1]: 256,
browse_range[0]: 1,
browse_range[1]: 256,
}
if nodata_value is not None:
# no_data_value_plus +1 to ensure that only no_data_value is
Expand All @@ -453,7 +454,7 @@ def make_browse_layer_generator(self, map_obj, browses, map_,
# due to offsite 0,0,0 will make all pixels below or equal to min transparent
layer_obj.setProcessingKey(
"SCALE_%d" % i,
"%s,%s" % tuple(range_)
"%s,%s" % tuple(browse_range)
)

else:
Expand Down Expand Up @@ -931,7 +932,7 @@ def _build_vrt(size, field_locations):
return path


def _create_raster_style(raster_style, layer, minvalue=0, maxvalue=255,
def _create_raster_style(raster_style: RasterStyle, layer, minvalue=0, maxvalue=255,
nil_values=None):
if raster_style.type == "ramp":
return _create_raster_style_ramp(
Expand Down

0 comments on commit 9f2d98e

Please sign in to comment.