[gdal-dev] images with different resolution.
oliver.eichler at gmx.de
Fri Sep 19 07:27:45 EDT 2008
> As Oliver as said, this is made with the RasterIO function, I think with
> nPixelSpace parameter. But what is the relation between the parameters
> nPixelSpace to pass to the the RasterIO function, and the
> of the two maps?
The trick is to define a common viewport, either in lon/lat or cartesian coordinates of unit meter. Now you can derive the needed offset and size in pixel you need to read from the files to display the visible parts in the viewport rectangle. And you can derive the offset of the left top corner of each tile within the viewport rectangle.
Please keep in mind that both map tiles need to have the same projection to work with RasterIO.
As said QLandkarte GT does exactly what you want. You just have to read the code. The adfGeoTransform is read in CMapFile::CMapFile(..).
All map files are combined by CMapLevel to one layer of same projection. And finally the CMapQMAP object that does the rendering.
If you have a look at the CMapQMAP::draw() method you will notice that it calculates the viewport rectangle in [m] first. As the next step it will calculate the intersecting rectangle within the map area. This intersecting rectangle is used to calculate the offset and the amount of pixels to read. The scale factors xzoomFactor and yzoomFactor are calculated on the base of the first file and used together with the overall zoom factor to scale the needed output pixel size.
More information about the gdal-dev