[Gdal-dev] Floating point pixel coordinates and scaling

Frank Warmerdam warmerdam at pobox.com
Wed Oct 13 13:24:26 EDT 2004


Rolf Magnus wrote:
> Hi!
> 
> I'm currently writing a moving map program for KDE that uses gdal. Basically, 
> I just use GDALDataSet::RasterIO in my paint event handler to get the pixels 
> that I need to redraw when some parts of my view get exposed. This is very 
> fast, even when I let gdal scale it on a slow PC.
> Anyway, I've got one specific problem with the scaling. When the image is to 
> be scaled up, the input coordinates might not lie on an exact pixel boundary. 
> I would need a way to specify e.g.  that I want to start at pixel coordinates 
> 200.125/150.25, which is not possible, because RasterIO wants integer 
> coordinates. I can work around that problem somehow, but I think it might be 
> a good idea to solve it in gdal itself. What do you people think about that?

Rolf,

I see the issue, and it has caused me headaches sometimes myself.  But the
use of integer windowing in the GDAL RasterIO() API is pretty deeply
embedded, and I am not planning to change it.

The warp api addresses issues like this in a more correct manner but I
think you would find the warp api quite a bit slower and not appropriate
for use in a repaint-proc.

In fact, for some file formats that don't support caching in GDAL you may
also find performance suffers dramatically - or in cases where the cache
isn't set high enough.  But I'm pleased to hear that it is working well for
you in most cases.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list