geodesign / django-raster

Django-raster allows you to create tiled map services (TMS) and raster map algebra end points for web maps. It is Python-based, and requires GeoDjango with a PostGIS backend.
BSD 3-Clause "New" or "Revised" License
96 stars 39 forks source link

Question regarding colormaps #31

Closed ElijasZ closed 6 years ago

ElijasZ commented 6 years ago

Hello, I am interested in restoring original colours of the image i have uploaded to my project. From what I've read so far there is a way to manipulate image colours using colormaps, however it is a bit unclear on how to implement them. Also it is mentioned in the beginning of the documentation that django-raster only uses a single band. In short could you confirm if it is possible to render image in its original colour, and perhaps give an example on how to implement colour maps. I know that asking of this is fairly rude but i can't imagine that I am the only noob trying to use this project .

yellowcap commented 6 years ago

@ElijasZ your question is justified, I am aware that the tile rendering would be much easier to understand with specific examples and rendered results in the docs. I did not have time to implement this unfortunately.

What is the colormap you are tyring to reproduce? Is it a continuous scale, discrete categories or multi-channel. (the package can now handle rendering rgb images as well)

If you give me some info about your colormap maybe I can point you in the right direction

ElijasZ commented 6 years ago

@yellowcap I am not exactly familiar with these terms, but i would make an assumption that it is multi-channel (just any random photo or drawing, that is georeferenced).

yellowcap commented 6 years ago

@ElijasZ sorry for the late answer. If you have a regular RGB layer, it will probably be parsed as 3-band raster. You can check that after the ingestion, in the Django admin you can check how many bands were found and extracted (through band metadata).

If you have an RGB layer, you can render it usfing the RGB rendering endpoint.

An example of a Leaflet/OpenLayers ready url is the following:

/raster/algebra/{z}/{x}/{y}.png?layers=r:0=23,g:1=23,b:2=23

Where the rasterlayer id is 23, and the rgb bands are band 0, 1 and 2.