Question

Raster Cell Origins


Badge +22
  • Contributor
  • 1961 replies

Can someone explain how FME handles raster cell origins?

 

 

In the RasterNumericCreator and RasterRGBCreator changing the X|Y Cell Origin values does not affect the extents of the image, the X|Y Upper Left Coordinate is always the edge of the pixel, not the origin.

Likewise changing the cell origin via RasterCellOriginSetter has no effect on the resultant raster.


13 replies

Userlevel 2
Badge +17

Hi @jdh, FME documentation describes as below.

"Cell origin is the point within each cell of a raster from which the pixel for that cell is derived. The lower left corner of the cell in the x or y dimension is 0.0, while the upper right corner is 1.0. A cell origin of 0.5 in x and 0.5 in y would put the data point for each cell in the center of the cell, which is the default representation in FME." -- Rasters (IFMERaster)

Cell origin does not affect the extents of the raster, but it affects the location of representative point for each cell. See the resulting points that would be output from the RaserCellCoercer (Output Cell Geometry: Points). They are the cell origin points.

Badge +22

Hi @jdh, FME documentation describes as below.

"Cell origin is the point within each cell of a raster from which the pixel for that cell is derived. The lower left corner of the cell in the x or y dimension is 0.0, while the upper right corner is 1.0. A cell origin of 0.5 in x and 0.5 in y would put the data point for each cell in the center of the cell, which is the default representation in FME." -- Rasters (IFMERaster)

Cell origin does not affect the extents of the raster, but it affects the location of representative point for each cell. See the resulting points that would be output from the RaserCellCoercer (Output Cell Geometry: Points). They are the cell origin points.

So if I have a raster whose georeferencing is based on the cell orgin, I would have to use the offsetter to correct for the half pixel shift, instead of trying to work with the origin?

 

 

Userlevel 2
Badge +17

Hi @jdh, FME documentation describes as below.

"Cell origin is the point within each cell of a raster from which the pixel for that cell is derived. The lower left corner of the cell in the x or y dimension is 0.0, while the upper right corner is 1.0. A cell origin of 0.5 in x and 0.5 in y would put the data point for each cell in the center of the cell, which is the default representation in FME." -- Rasters (IFMERaster)

Cell origin does not affect the extents of the raster, but it affects the location of representative point for each cell. See the resulting points that would be output from the RaserCellCoercer (Output Cell Geometry: Points). They are the cell origin points.

Cell origin is a normalized coordinates within each cell, it doesn't represent any actual location in a specific coordinate system. I'm unclear what operation you described as "georeferencing is based on the cell origin".

 

Badge +22
Cell origin is a normalized coordinates within each cell, it doesn't represent any actual location in a specific coordinate system. I'm unclear what operation you described as "georeferencing is based on the cell origin".

 

I have the parameters for an affine transformation of the raw images. Essentially the same data that would be found in a world file (tfw), when I send the raster to the Affiner (or even the RasterGeoreferencer, when there is no rotation) the results are off by half a pixel in both axes.

 

 

That suggests to me that the georeferencing information I have is based on the center of the pixel (origin 0.5,0.5) rather than the the upper left edge (origin 0,1).

 

 

Userlevel 2
Badge +17

Hi @jdh, FME documentation describes as below.

"Cell origin is the point within each cell of a raster from which the pixel for that cell is derived. The lower left corner of the cell in the x or y dimension is 0.0, while the upper right corner is 1.0. A cell origin of 0.5 in x and 0.5 in y would put the data point for each cell in the center of the cell, which is the default representation in FME." -- Rasters (IFMERaster)

Cell origin does not affect the extents of the raster, but it affects the location of representative point for each cell. See the resulting points that would be output from the RaserCellCoercer (Output Cell Geometry: Points). They are the cell origin points.

hmm, I'm still unclear what situation you observed is. I cannot see any difference in georeferencing result between two rasters having different cell origin.

 

Badge +22
hmm, I'm still unclear what situation you observed is. I cannot see any difference in georeferencing result between two rasters having different cell origin.

 

They don't which is my problem. If I look at the image in the original software, and I look at the same image as georeferenced by FME, they are offset by half a pixel.

 

 

Likewise if I create a tfw file, and then read the tiff+tfw via a normal tiff reader, vs reading in the tiff (without a tfw) and applying the same values in the raster georeferencer (except for the y which is -E), the two images are offset by that half-pixel.

 

 

Badge +2

Hi @jdh, This does sounds a bit confusing to me as well, so I asked our developer for some clarification.

In FME, each row and column intersection is considered to be an area (i.e. a cell), rather than a single point. All raster georeferencing in FME treats the extents as being based on areas rather than individual points. The cell origin specifies where within a cell a single point would fall, but it doesn't impact the extents, since the extents are based on areas.

With raster georeferencing, it is important to be careful of what it actually represents. For example, in FME the origin of a raster is the upper left corner of the upper left cell (note that the cell origin has no impact to origin of a raster). In contrast, a world file specifies the center of the upper left cell (https://en.wikipedia.org/wiki/World_file). In your scenario, when you use the same georeferencing as what's found in a world file, you would need to adjust the georeferencing to correspond to FME's model, rather than using it as is.

 

Hope this explanation makes sense, and we will look for an appropriate place to document this, so to avoid future confusions.
Badge +22

Hi @jdh, This does sounds a bit confusing to me as well, so I asked our developer for some clarification.

In FME, each row and column intersection is considered to be an area (i.e. a cell), rather than a single point. All raster georeferencing in FME treats the extents as being based on areas rather than individual points. The cell origin specifies where within a cell a single point would fall, but it doesn't impact the extents, since the extents are based on areas.

With raster georeferencing, it is important to be careful of what it actually represents. For example, in FME the origin of a raster is the upper left corner of the upper left cell (note that the cell origin has no impact to origin of a raster). In contrast, a world file specifies the center of the upper left cell (https://en.wikipedia.org/wiki/World_file). In your scenario, when you use the same georeferencing as what's found in a world file, you would need to adjust the georeferencing to correspond to FME's model, rather than using it as is.

 

Hope this explanation makes sense, and we will look for an appropriate place to document this, so to avoid future confusions.
So instead of using the C,F parameters directly, use C-A/2 and F-E/2?

 

 

Badge +22

Hi @jdh, This does sounds a bit confusing to me as well, so I asked our developer for some clarification.

In FME, each row and column intersection is considered to be an area (i.e. a cell), rather than a single point. All raster georeferencing in FME treats the extents as being based on areas rather than individual points. The cell origin specifies where within a cell a single point would fall, but it doesn't impact the extents, since the extents are based on areas.

With raster georeferencing, it is important to be careful of what it actually represents. For example, in FME the origin of a raster is the upper left corner of the upper left cell (note that the cell origin has no impact to origin of a raster). In contrast, a world file specifies the center of the upper left cell (https://en.wikipedia.org/wiki/World_file). In your scenario, when you use the same georeferencing as what's found in a world file, you would need to adjust the georeferencing to correspond to FME's model, rather than using it as is.

 

Hope this explanation makes sense, and we will look for an appropriate place to document this, so to avoid future confusions.
PS. A good place to start with documentation would be https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_ReadersWriters/RasterFeatures/Raster-Properties.htm

 

 

Which is incorrect in regards to the raster origin, in the first place (lower vs upper).

 

 

Badge +2
So instead of using the C,F parameters directly, use C-A/2 and F-E/2?

 

 

That sounds right, If E is negative.

 

Badge +2
PS. A good place to start with documentation would be https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_ReadersWriters/RasterFeatures/Raster-Properties.htm

 

 

Which is incorrect in regards to the raster origin, in the first place (lower vs upper).

 

 

Thanks @jdh. That was definitely incorrect. I have reported to the doc team to correct that mistake. Thank you for pointing it out.

 

Badge +2
So instead of using the C,F parameters directly, use C-A/2 and F-E/2?

 

 

@jdh, It was just pointed out to me, we might want to also consider the possibility that the raster might be rotated as well. In that case, we should use the following adjustments: C - (A/2 + B/2) and F - (D/2 + E/2). Hope this helps.

 

Badge +22
@jdh, It was just pointed out to me, we might want to also consider the possibility that the raster might be rotated as well. In that case, we should use the following adjustments: C - (A/2 + B/2) and F - (D/2 + E/2). Hope this helps.

 

Wouldn't it be C- sqrt (A^2 + D^2)/2 and F-sqrt(B^2 + E^2) if there were rotation?

 

Reply