Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix bug with rasterstyle and browse_range #578

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading