<div dir="ltr"><div>Dear PostGIS users,</div><div><br></div><div>we are thinking about the optimal way how to store 
rasters pixel metadata. Lets say, we have 
2BUI 

pixel type [<a href="https://postgis.net/docs/RT_ST_BandPixelType.html">1</a>] and want to use the following codes:<br></div><div><br></div><div>code 0 as NoData,<br></div><div>1 as forest,<br></div><div>2 as non-forest,<br></div><div>the rest of possible values (value 3) should not be used.<br></div><div><br></div><div>We would like to store somewhere this "mapping" / lookup table [<a href="https://en.wikipedia.org/wiki/Lookup_table#Lookup_tables_in_image_processing">2</a>] between pixel value and its meaning (interpretation). We do not like to put this information into table comments. We are thinking about a separate table to store this mapping. Also we would like to create constraints (like foreign keys) based on used codes (to disable using value 3) maybe with help of functions like ST_ValueCount

 [<a href="https://postgis.net/docs/RT_ST_ValueCount.html">3</a>],
ST_SummaryStats

[<a href="https://postgis.net/docs/RT_ST_SummaryStats.html">4</a>]?. Question is, whether each row (tile) could have different mapping or it should be constant to all rows / tiles (analogy to other raster properties such as resolution, number of bands etc. [<a href="https://postgis.net/docs/RT_AddRasterConstraints.html">5</a>]). <br></div><div><br></div><div>Thank you for any ideas, is there any "best practice"? <br></div><div><br></div><div>Regards, Jiří Fejfar.</div><div><br></div><div>[1] <a href="https://postgis.net/docs/RT_ST_BandPixelType.html">https://postgis.net/docs/RT_ST_BandPixelType.html</a></div><div>[2] <a href="https://en.wikipedia.org/wiki/Lookup_table#Lookup_tables_in_image_processing">https://en.wikipedia.org/wiki/Lookup_table#Lookup_tables_in_image_processing</a></div><div>
<div>[3] <a href="https://postgis.net/docs/RT_ST_ValueCount.html">https://postgis.net/docs/RT_ST_ValueCount.html</a></div><div>[4] <a href="https://postgis.net/docs/RT_ST_SummaryStats.html">https://postgis.net/docs/RT_ST_SummaryStats.html</a></div>

</div><div>[5] <a href="https://postgis.net/docs/RT_AddRasterConstraints.html">https://postgis.net/docs/RT_AddRasterConstraints.html</a></div></div>