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

Add support to multi-band color mapping for COG layers #9588

Closed
1 of 6 tasks
Tracked by #9593
offtherailz opened this issue Oct 12, 2023 · 5 comments · Fixed by #10107 or #9857
Closed
1 of 6 tasks
Tracked by #9593

Add support to multi-band color mapping for COG layers #9588

offtherailz opened this issue Oct 12, 2023 · 5 comments · Fixed by #10107 or #9857

Comments

@offtherailz
Copy link
Member

offtherailz commented Oct 12, 2023

Description

As visible here, we can associate the colors to bands. Actually mapstore supports only standard 3 bands RGB or 1 band gray (because it is the openlayers default)

We have to implement the support to associate colors to bands.
This means:

  • Retrieve bands information from metadata (in advance from catalog, or when needed)
  • to persist the association of bands with color. It should be implemented in a
    • styling model and format open to future updates as color scales or other known raster styling formats.
    • Compatible to be read to cesium implementation for future implementation
  • Provide a UI to edit this style (ideally both in catalog and layer style tab)

What kind of improvement you want to add? (check one with "x", remove the others)

  • Minor changes to existing features
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

Other useful information

@offtherailz offtherailz changed the title Add support to band mapping for COG layers Add support to multi-band color mapping for COG layers Oct 12, 2023
@tdipisa tdipisa mentioned this issue Oct 12, 2023
6 tasks
@tdipisa tdipisa added this to the 2023.02.02 milestone Oct 12, 2023
@tdipisa tdipisa assigned dsuren1 and unassigned tdipisa Nov 27, 2023
@dsuren1
Copy link
Contributor

dsuren1 commented Dec 11, 2023

As part of fetching metadata, we read only one image to get metadata info of the tif source. Reading raster data of the entire image can puts too much load on CPU and can severly impact performance, hence we need to specify a window/bbox, width, height and pooling to read raster data. We can specify some defaults to fetch from but we can't assure that it always reads the area of interest.

So my thoughts, we can get the banding information from the user in catalog and add it to COG source for user defined rendering of tif source and skip any reading of banding info from the image in catalog.
And In layer -> style, we can allow user to pick a aoi by allowing user to click a point on map and using layer's getData to get rgba value to populate the bands fields?

Mocks

  • This way we can also modify the band on the fly by changing values via input fields (As @allyoucanmap pointed, Slider field can be difficult to pick accurate values when min/max difference is large, hence modified to input field)

    image
  • Or should we also allow user to modify the channels to certain colors as shown here?

    Screenshot 2023-12-11 at 5 38 38 PM

We can discuss on this @offtherailz to establish an acceptance criteria

@dsuren1
Copy link
Contributor

dsuren1 commented Dec 12, 2023

Updated acceptance criteria

  • As part of this issue, support for only single and 3 bands (RGB)
  • Retrieve band information from metadata. Reading the image's raster data is not required as the samples/band information can be obtained from getSamplesPerPixel
    • If RGB, set style color with an array of bands in OL supported expression
    • If the image is a single band set band [1] to all bands
    • there are cases where the max/min value of source data value is required when raster statistics is not available at the source leaving OL to use the maximum available for the data type which could leave the rendered image to be not visually appealing. Maybe this could be a future enhancement or we could add these fields in the style panel for the user to configure after the layer is added. Your thoughts @offtherailz ?
  • In layer -> style, the user should be able to select Channel based on the bands available. Should we show Alpha channel when applicable @offtherailz ?
    Screenshot 2023-12-12 at 8 38 37 PM
  • Save the style of the layer. (Export/Save map)

@offtherailz
Copy link
Member Author

Max/Min

About min/max please ask to @tdipisa if it should be done in this dev cycle. I was thinking to work values of data more with advanced style features (like calculations an so and so) in a context of an advanced raster styler).
I think the choice to implement them now or layer is in what it means required. What happens if we do not have them?

Apha channel

Yes, good idea. I think it can stay always together with the RGB, and optional (can be unselected). look at similar tools to get an idea of how it should work.

@tdipisa
Copy link
Member

tdipisa commented Dec 15, 2023

@dsuren1

there are cases where the max/min value of source data value is required when raster statistics is not available at the source leaving OL to use the maximum available for the data type which could leave the rendered image to be not visually appealing. Maybe this could be a future enhancement or we could add these fields in the style panel for the user to configure after the layer is added. Your thoughts @offtherailz ?

Since the support for min/max in 'layer settings->style' is included in your evaluation please consider also this in the development so that we will be able to better support also these special cases if needed.

dsuren1 added a commit to dsuren1/MapStore2 that referenced this issue Jan 9, 2024
@dsuren1 dsuren1 linked a pull request Jan 9, 2024 that will close this issue
6 tasks
@tdipisa tdipisa modified the milestones: 2023.02.02, 2024.01.00 Jan 22, 2024
@tdipisa tdipisa added the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Mar 5, 2024
@tdipisa
Copy link
Member

tdipisa commented Mar 19, 2024

blocked by #10083

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment