GDAL CLI: raster calc - make lng/lat available in 'calc'
Feature description
Greetings,
'gdal raster calc' has pixel values in the A or A[band] format.
The feature request would be to make lng/lat available in --calc, ie, something like A[x] for lng, A[y] for lat. This would be like making an entire new band of information available with no new overhead.
Whether you're calculating sun angles, temperate zones, declination, etc, on the fly, it would be a HUGE addition for many applications.
Thanks! Scott
Additional context
No response
Do the _CENTER_X_ and _CENTER_Y_ built-in variables work for you, or do you need lat/lon values for a raster in projected coordinates?
Do the
_CENTER_X_and_CENTER_Y_built-in variables work for you, or do you need lat/lon values for a raster in projected coordinates?
Thanks for the quick response, Dan!
I'm unfamiliar with those built in variables. Are they documented somewhere?
If CENTER* vars are pixel row/column and not lat/lon in data set CRS, then I think that would require some hoops to jump through? I'm not sure, I don't know what they are. :)
They are the cell center X/Y in the dataset CRS. They're described on the VRT driver page under the "expression" pixel function (https://gdal.org/en/latest/drivers/raster/vrt.html#built-in-pixel-functions). But I can appreciate that you would have no reason to go looking for the information there -- it should be made clear in the gdal raster calc doc.
They are the cell center X/Y in the dataset CRS. They're described on the VRT driver page under the "expression" pixel function
That works perfect. Thanks Dan!