Skip to content

Commit

Permalink
Fixing regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
constantinius committed Sep 15, 2023
1 parent 0e87b7c commit 0af02fc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion eoxserver/render/browse/defaultstyles.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
for name, entries in COLOR_SCALES.items():
DEFAULT_RASTER_STYLES[name] = RasterStyle(
name,
"ramp",
name,
name,
"ramp",
[
RasterStyleColorEntry(i, color)
for i, color in entries
Expand Down
10 changes: 6 additions & 4 deletions eoxserver/render/browse/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def footprint(self):
return polygon

@classmethod
def from_model(cls, product_model, browse_model):
def from_model(cls, product_model, browse_model, raster_styles=None):
filename = get_vsi_path(browse_model)
env = get_vsi_env(browse_model.storage)
size = (browse_model.width, browse_model.height)
Expand All @@ -129,11 +129,12 @@ def from_model(cls, product_model, browse_model):
return cls(
name, filename, env, size, extent,
browse_model.coordinate_reference_system, mode,
product_model.footprint
product_model.footprint,
raster_styles if raster_styles is not None else {}
)

@classmethod
def from_file(cls, filename, env=None):
def from_file(cls, filename, env=None, raster_styles=None):
env = env or {}
ds = gdal.Open(filename)
size = (ds.RasterXSize, ds.RasterYSize)
Expand All @@ -142,7 +143,8 @@ def from_file(cls, filename, env=None):

return cls(
filename, env, filename, size, extent,
ds.GetProjection(), mode, None
ds.GetProjection(), mode, None,
raster_styles if raster_styles is not None else {},
)


Expand Down
5 changes: 4 additions & 1 deletion eoxserver/render/mapserver/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ def create_coverage_layer(self, map_obj: Map, coverage: Coverage, fields: List[F

for layer_obj in layer_objs:
_create_raster_style(
style or "blackwhite", layer_obj, range_[0], range_[1], [
DEFAULT_RASTER_STYLES[style or "blackwhite"],
layer_obj,
range_[0],
range_[1], [
nil_value[0] for nil_value in field.nil_values
]
)
Expand Down

0 comments on commit 0af02fc

Please sign in to comment.