I have a postgres table to store rasters having elevation value in each pixels. the raster size on average is around 100x100 with scale of 1. The elevation value is historic and I store timestamp in band 1 and elevation value in band 2

I need to store this historical value in the same raster as and when I receive data instead of creating new raster. This is to avoid multiple rasters in the same table created over period of time. Is there a way to do it?

1 Answer 1


No - if you were to find a practical way to en- and decode arbitrary numeric values within a single, practically sized¹ numerical representation (i.e. the bit-range of the common data types), or find a way around the limitations of spline and polynominal interpolation for functional representation, you'd be a Nobel prize money billionaire.

However, you could simply abstract your time series into raster bands:

  • add a new band with a time bin as close as possible to the interval range in which you are receiving updates; e.g. one band per day/week/month/year
  • encode the EPOCH seconds and the height value in a 64BF pixel value - you will have 16 digits available to do so: 17 digits considered for output, minus one to avoid floating point rounding errors, e.g.:
    • [+/-]hhhhhh: height [cm]
    • ssssssssss: timestamp in EPOCH seconds
    • [x]: unused digit to avoid rounding issues

¹ Mathematically, you can encode any finite range of numbers consecutively within a single number, with plenty of means - but in any case, this number would have an obscene amount of digits (think millions) very quickly...

  • I got ur answer of the approach is not feasible straightforward and only work arounds are available. Thanks Commented Dec 8, 2021 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.