RasterGridFilter

Feel free to ask any question here
Post Reply
dm_red
Posts: 10
Joined: Thu Jan 26, 2017 6:48 pm

RasterGridFilter

Post by dm_red »

Hello, i have question about libs/qCC_io/RasterGridFilter.cpp

line 165:

Code: Select all

CCVector3d B = origin + Pshift; //origin is 'top left'
CCVector3d C = B;
C.x += (rasterX - 1) * adfGeoTransform[1];
C.y += (rasterX - 1) * adfGeoTransform[4];
CCVector3d D = C;
D.x += (rasterY - 1) * adfGeoTransform[2];
D.y += (rasterY - 1) * adfGeoTransform[5];
CCVector3d A = B;
A.x += (rasterY - 1) * adfGeoTransform[2];
A.y += (rasterY - 1) * adfGeoTransform[5];
Why (rasterX - 1) and (rasterY - 1)?

From http://gdal.org/gdal_datamodel.html :
Note that the pixel/line coordinates in the above are from (0.0,0.0) at the top left corner of the top left pixel to (width_in_pixels,height_in_pixels) at the bottom right corner of the bottom right pixel. The pixel/line location of the center of the top left pixel would therefore be (0.5,0.5).

For example, if i have raster image, which have only one pixel(height = 1, width = 1), then B=C=D=A - it seems incorrect.
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: RasterGridFilter

Post by daniel »

I believe your are right. This was the old way CC was handling raster images.

We have fixed this in the Rasterize tool, but I guess the Raster I/O filter was not fixed.

I've fixed that (in the sources for now). Thanks for the feedback.
Daniel, CloudCompare admin
Post Reply