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

Range is not applied to default colormap #66

Open
henhuy opened this issue Sep 15, 2021 · 0 comments · May be fixed by #67
Open

Range is not applied to default colormap #66

henhuy opened this issue Sep 15, 2021 · 0 comments · May be fixed by #67

Comments

@henhuy
Copy link

henhuy commented Sep 15, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant