Feature/sc 488704/support labeldescription in raster loader#174
Closed
Feature/sc 488704/support labeldescription in raster loader#174
Conversation
…ader' of github.com:CartoDB/raster-loader into feature/sc-488704/support-labeldescription-in-raster-loader
cayetanobv
requested changes
Jun 25, 2025
Member
cayetanobv
left a comment
There was a problem hiding this comment.
A general note about dependencies: This feature adds GDAL as a dependency; this is a major change, as we previously used Rasterio with the precompiled GDAL included in the Python Wheel. I understand this is because Rasterio doesn't yet include this feature. However, this entails several aspects to keep in mind:
- We need GDAL installed on the system to install and use raster-loader. This wasn't necessary before.
- We use two different GDAL instances in the library: the one preinstalled with Rasterio and the one installed on the system to manage RATs. The versions can be different, and this can cause problems or incompatibilities. One option is not to use the precompiled Rasterio and install it using the system's GDAL; but this complicates the installation significantly.
As soon as Rasterio releases this feature in the next version (maybe), I would consider moving to using Rasterio for RATs for homogeneity in the library: rasterio/rasterio#3252
Member
Author
|
Closing this one in favor of #175, including valuelabels only from the command line option. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Fixes #
Proposed Changes
Adding new metadata field by band as
valuelabelsdict of value-labels pairs. i.e:{ "band_1": { "colorinterp": "palette", "nodata": 0, "valuelabels": { "1": "Corn", "5": "Soybeans", "21": "Barley", "121": "Developed/Open Space" }, "colortable": { "1": [255, 211, 0, 255], "5": [37, 111, 0, 255], "21": [226, 0, 124, 255], "121": [153, 153, 153, 255] } } }This dictionary can be obtained from two sources:
1. Via command line parameter
It can be by adding the
--band-valuelabels:For example (Note the
Using the provided valuelabels for band 1in the output:2. Raster Attribute Table (RAT) from the tiff file
For a file-based raster dataset, the raster attribute table must be at the same directory level as the raster, using the same name as the raster but with either the
.vat.dbfor.aux.xmlformat (and extension). For example, for rasterSanDiego.tif, the raster attribute table must beSanDiego.tif.vat.dbforSanDiego.tif.aux.xmlin the same folder.For example, having the files:
And the interactive mode:
Pull Request Checklist
Additional Information
[Anything else you'd like to include.]