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

Additional colormaps do not appear in colorMaps/* response #458

Open
1 task
anayeaye opened this issue Feb 11, 2025 · 4 comments
Open
1 task

Additional colormaps do not appear in colorMaps/* response #458

anayeaye opened this issue Feb 11, 2025 · 4 comments
Assignees

Comments

@anayeaye
Copy link
Collaborator

What

Titiler supports additional custom colormaps but the custom colormaps are not returned in the colorMaps endpoint to list available colormaps or the colorMaps/{colormapName} metadata endpoint.

For example, the nlcd colormap can be used to render tiles
https://openveda.cloud/api/raster/collections/nlcd-annual-conus/items/nlcd_2001_cog_v2/preview.png?bidx=1&assets=landcover&nodata=0&resampling=nearest&colormap_name=nlcd

But nlcd is not in the response for https://openveda.cloud/api/raster/colorMaps

AC

  • colorMaps* endpoints return custom colormaps in addition to default colormaps
@anayeaye
Copy link
Collaborator Author

@vincentsarago do you think we need to make a change in veda-backend to return additional custom colormaps in the colorMaps response? And/or should we open a titiler issue?

@smohiudd
Copy link
Contributor

smohiudd commented Mar 4, 2025

The Colormaps factory that we're using only includes the default colormaps.

We need to somehow append the custom colormaps as well.

It looks like the other factories just reference the custom colormap dependency so maybe we can do the same with ColorMapFactory()

cog = TilerFactory(
    router_prefix="/cog",
    optional_headers=optional_headers,
    environment_dependency=settings.get_gdal_config,
    router=APIRouter(route_class=LoggerRouteHandler),
    extensions=[
        cogValidateExtension(),
        cogViewerExtension(),
    ],
    colormap_dependency=ColorMapParams,
)

@botanical
Copy link
Member

Deployed changes to dev and confirmed that the colormap endpoint now returns the additional colormaps

curl -X 'GET' \
  'https://dev.openveda.cloud/api/raster/colorMaps' \
  -H 'accept: application/json'

{"colorMaps":["accent","accent_r","afmhot","afmhot_r","algae","algae_r","amp","amp_r","autumn","autumn_r","balance","balance_r","binary","binary_r","blues","blues_r","bone","bone_r","brbg","brbg_r","brg","brg_r","bugn","bugn_r","bupu","bupu_r","bwr","bwr_r","cfastie","cividis","cividis_r","cmrmap","cmrmap_r","cool","cool_r","coolwarm","coolwarm_r","copper","copper_r","cubehelix","cubehelix_r","curl","curl_r","dark2","dark2_r","deep","deep_r","delta","delta_r","dense","dense_r","diff","diff_r","flag","flag_r","gist_earth","gist_earth_r","gist_gray","gist_gray_r","gist_heat","gist_heat_r","gist_ncar","gist_ncar_r","gist_rainbow","gist_rainbow_r","gist_stern","gist_stern_r","gist_yarg","gist_yarg_r","gnbu","gnbu_r","gnuplot","gnuplot2","gnuplot2_r","gnuplot_r","gray","gray_r","greens","greens_r","greys","greys_r","haline","haline_r","hot","hot_r","hsv","hsv_r","ice","ice_r","inferno","inferno_r","jet","jet_r","magma","magma_r","matter","matter_r","nipy_spectral","nipy_spectral_r","ocean","ocean_r","oranges","oranges_r","orrd","orrd_r","oxy","oxy_r","paired","paired_r","pastel1","pastel1_r","pastel2","pastel2_r","phase","phase_r","pink","pink_r","piyg","piyg_r","plasma","plasma_r","prgn","prgn_r","prism","prism_r","pubu","pubu_r","pubugn","pubugn_r","puor","puor_r","purd","purd_r","purples","purples_r","rain","rain_r","rainbow","rainbow_r","rdbu","rdbu_r","rdgy","rdgy_r","rdpu","rdpu_r","rdylbu","rdylbu_r","rdylgn","rdylgn_r","reds","reds_r","rplumbo","schwarzwald","seismic","seismic_r","set1","set1_r","set2","set2_r","set3","set3_r","solar","solar_r","spectral","spectral_r","speed","speed_r","spring","spring_r","summer","summer_r","tab10","tab10_r","tab20","tab20_r","tab20b","tab20b_r","tab20c","tab20c_r","tarn","tarn_r","tempo","tempo_r","terrain","terrain_r","thermal","thermal_r","topo","topo_r","turbid","turbid_r","turbo","turbo_r","twilight","twilight_r","twilight_shifted","twilight_shifted_r","viridis","viridis_r","winter","winter_r","wistia","wistia_r","ylgn","ylgn_r","ylgnbu","ylgnbu_r","ylorbr","ylorbr_r","ylorrd","ylorrd_r","epa-ghgi-ch4","nlcd","soil_texture","surface_temperature","tornado_ef_scale"],"links":[{"href":"https://dev.openveda.cloud/api/raster/colorMaps","rel":"self","type":"application/json","title":"List of available colormaps"},{"href":"https://dev.openveda.cloud/api/raster/colorMaps/{colorMapId}","rel":"data","type":"application/json","templated":true,"title":"Retrieve colorMap metadata"},{"href":"https://dev.openveda.cloud/api/raster/colorMaps/{colorMapId}?format=png","rel":"data","type":"image/png","templated":true,"title":"Retrieve colorMap as image"}]}%

@anayeaye
Copy link
Collaborator Author

anayeaye commented Mar 7, 2025

@botanical do you think there is a similar fix for the colorMap/<colormapId> endpoint? I haven't looked at the change that fixed the colormap list but I hope it will be something similar to support the colormap metadata/legend endpoint

botanical added a commit that referenced this issue Mar 10, 2025
### Issue


#458 (comment)

### What?/ Why?

- `colorMaps` endpoint was returning the new colormaps but
`colorMaps/colorMapId` wasn't.

### Testing?

https://jtran.delta-backend.com/api/raster/docs#/ColorMaps/getColorMap

<img width="1682" alt="Screenshot 2025-03-10 at 2 59 35 PM"
src="https://github.com/user-attachments/assets/54f9faeb-5322-4431-9070-e436c56dc41b"
/>
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

No branches or pull requests

3 participants