Skip to content

Range is not applied to default colormap #66

@henhuy

Description

@henhuy

Default colormap (if not setting up a legend) is not working properly (no range attribute set).
This leads to color artefacts like this:
grafik

This is related to code in

if not colormap:
# Use a continous grayscale color scheme.
colormap = {
'continuous': True,
'from': (0, 0, 0),
'to': (255, 255, 255),
}
else:
# Add layer level value range to continuous colormaps if it was
# not provided manually.
if 'continuous' in colormap and 'range' not in colormap:
meta = RasterLayerBandMetadata.objects.filter(rasterlayer_id=self.kwargs.get('layer')).first()
if meta:
colormap['range'] = (meta.min, meta.max)
# Filter by custom entries if requested
if colormap and 'entries' in self.request.GET:
entries = self.request.GET['entries'].split(',')
colormap = {k: v for (k, v) in colormap.items() if str(k) in entries}

as range and entries are only added if colormap exists in the first place.
After removing else and unindending range and entries part, raster layer looks as expected:
grafik

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions