You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When comparing the DEM that comes with RTC products (*_dem.tif) against the original NED, I observed an obvious shift between them. After going through get_dem.py, I realized that NED was shifted by half a pixel towards the lower right corner in order to convert to PixelIsPoint.
However, I believe that this manual shift/offset is not necessary because GDAL will handle this offset when you change AREA_OR_POINT. Please see below for the reasons and an example.
AREA_OR_POINT
Used in GDAL Raster Data Model to indicate whether a pixel value should be assumed to represent a sampling over the region of the pixel or a point sample at the center of the pixel.
It does not influence the interpretation of georeferencing, which remains AREA oriented. The coefficients in GeoTransform should always be considered as area-based, i.e., (GT(0), GT(3)) position is ALWAYS the top left corner of the top left pixel of the raster.
In ancient GDAL versions, PixelIsPoint/PixelIsArea of a GeoTIFF file was misinterpreted w.r.t. GeoTransform, causing an offset by half a pixel. This has been fixed in the recent GDAL versions. See RFC 33: GTiff - Fixing PixelIsPoint Interpretation. Users can set GTIFF_POINT_GEO_IGNORE to TRUE to revert back to the behavior of ancient GDAL versions.
By default (GTIFF_POINT_GEO_IGNORE = FALSE), changing AREA_OR_POINT for a GeoTIFF file will NOT affect the GeoTransform coefficients when read in by GDAL, nor the corner coordinates seen in gdalinfo, as they are both area-based. What is affected is the model tiepoint in ModelTiepointTag of GeoTIFF file, which can seen as Tag 33922 in tiffinfo.
Therefore, there is no need to manually do an offset of half a pixel when changing AREA_OR_POINT. GDAL will by default adjust the model tiepoint in ModelTiepointTag for a GeoTIFF file.
The coefficients in GeoTransform remain unchanged because they are always area-based in GDAL. However, ModelTiePoint is offset by half a pixel towards the lower right corner, which proves that changing AREA_OR_POINT will make the offset for the tiepoint of GeoTIFF file. There is no need to manually do an extra offset.
Now, we change AREA_OR_POINT to POINT but with GTIFF_POINT_GEO_IGNORE set to TRUE.
As seen in GeoTransform, this will cause an offset by half a pixel towards the upper left corner. This behavior is not desired as it changes the spatial extent of the raster.
Summary
In get_dem.py or set_pixel_as_point, the manual offset of half a pixel is not necessary (unless GTIFF_POINT_GEO_IGNORE was set to TRUE in RTC jobs). The extra offset will cause the spatial extent of a raster to be actually shifted by half a pixel, which should not be the case when we just want to express pixels as area or point.
Context
When comparing the DEM that comes with RTC products (*_dem.tif) against the original NED, I observed an obvious shift between them. After going through get_dem.py, I realized that NED was shifted by half a pixel towards the lower right corner in order to convert to PixelIsPoint.
However, I believe that this manual shift/offset is not necessary because GDAL will handle this offset when you change AREA_OR_POINT. Please see below for the reasons and an example.
AREA_OR_POINT
Used in GDAL Raster Data Model to indicate whether a pixel value should be assumed to represent a sampling over the region of the pixel or a point sample at the center of the pixel.
It does not influence the interpretation of georeferencing, which remains AREA oriented. The coefficients in GeoTransform should always be considered as area-based, i.e., (GT(0), GT(3)) position is ALWAYS the top left corner of the top left pixel of the raster.
In ancient GDAL versions, PixelIsPoint/PixelIsArea of a GeoTIFF file was misinterpreted w.r.t. GeoTransform, causing an offset by half a pixel. This has been fixed in the recent GDAL versions. See RFC 33: GTiff - Fixing PixelIsPoint Interpretation. Users can set GTIFF_POINT_GEO_IGNORE to TRUE to revert back to the behavior of ancient GDAL versions.
By default (GTIFF_POINT_GEO_IGNORE = FALSE), changing AREA_OR_POINT for a GeoTIFF file will NOT affect the GeoTransform coefficients when read in by GDAL, nor the corner coordinates seen in gdalinfo, as they are both area-based. What is affected is the model tiepoint in ModelTiepointTag of GeoTIFF file, which can seen as Tag 33922 in tiffinfo.
Therefore, there is no need to manually do an offset of half a pixel when changing AREA_OR_POINT. GDAL will by default adjust the model tiepoint in ModelTiepointTag for a GeoTIFF file.
Example
We can see that the coordinates are consistent in both GeoTransform and ModelTiePoint, as this raster is PixelIsArea.
Now, we change AREA_OR_POINT to POINT (i.e., PixelIsPoint).
The coefficients in GeoTransform remain unchanged because they are always area-based in GDAL. However, ModelTiePoint is offset by half a pixel towards the lower right corner, which proves that changing AREA_OR_POINT will make the offset for the tiepoint of GeoTIFF file. There is no need to manually do an extra offset.
Now, we change AREA_OR_POINT to POINT but with GTIFF_POINT_GEO_IGNORE set to TRUE.
Before checking GeoTransform again, set GTIFF_POINT_GEO_IGNORE to FALSE to see the effect under default GDAL configuration.
As seen in GeoTransform, this will cause an offset by half a pixel towards the upper left corner. This behavior is not desired as it changes the spatial extent of the raster.
Summary
In get_dem.py or set_pixel_as_point, the manual offset of half a pixel is not necessary (unless GTIFF_POINT_GEO_IGNORE was set to TRUE in RTC jobs). The extra offset will cause the spatial extent of a raster to be actually shifted by half a pixel, which should not be the case when we just want to express pixels as area or point.
References
OGC GeoTIFF Standard
GDAL - Raster Data Model
GDAL - GeoTIFF File Format
The text was updated successfully, but these errors were encountered: