1

My question is about how ST_Union of rasters containing NULL values are handled. For example suppose I have two rasters that intersect but the values of the intersection are NULL in one of the rasters. According to the documentation ST_Union takes the last value by default.

Does this mean that the unionized raster would contain null values at the intersecting locations where the second raster was null? In other words if one of the two rasters contains null values at the intersecting points (pixels) does order matter?

I am motivated to understand this because some of my rasters were not perfectly aligned and ST_SnapToGrid created extra an extra row/column on some of my rasters that contains only null values.

  • I don't know and can't find the documentation on whether nulls can be ignored or not. First and Last would be order dependent. Any math (sum/min/max/mean/etc) on a null results in a null. So if nulls cannot be ignored, you'll get a null. If they can be, you'll get the value of the operation on all non-null cells; if it were count you'd get the number of non-null inputs. ST_MapAlgebra has parameters for what to do with null values in either or both inputs - maybe that would be better than union for your purpose? – Chris W Jun 15 '15 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.