[Gdal-dev] Compositing warped images

Frank Warmerdam warmerdam at pobox.com
Thu Jan 29 10:00:12 EST 2004


Robert Osfield wrote:
> Hi All,
> 
> I am currently working on adding to the OpenSceneGraph the ability to creating 
> scene graph from multiple source images and DEM's.  Using GDAL I have 
> implemented the ability to warp all the source data into the same projection, 
> and then extract tiles from the warped source data into LOD'd geometry and 
> texture map tiles.  
> 
> I am using the GDALWarpOperation::ChunkAndWarpImage(..) as per the GDAL Warp 
> API Tutorial to do the warping into the same projection, and 
> GDALRasterBand::RasterIO(..) method to extract the tiles.  I must say that I 
> thoroughly impressed at the power that GDAL provides with such a compact set 
> of API's :)

Robert,

Thanks!

> Now onto the problem in hand...  the warping itself creates black/null data 
> areas at the edges which when the tile data is extracted the black areas are 
> copied into the destination imagery/height field overwritting previous valid 
> values.  What would be ideal for me would be for only valid values to be 
> copied across to the destination, with null data ignored.  I havn't spotted a 
> way of doing this with the RasterIO method so far, is there a way of doing 
> this?

No, and it is unlikely that RasterIO() (already a pretty complicated monster)
will have that added.  The warper does have a concept of "nodata" values but
I am loath to add that complication to RasterIO().

> My fallback is to copy the extracted tile into a local tempory data area, then 
> copy from this to the final destination, filtering the data as I go.  
> However, this does mean allocating extra data.  Each of these tiles is not 
> too big, typically around 256x256, and unlikey to get bigger than 1024x1024, 
> and the tempory data can always be used.  So memory consumption isn't a real 
> issue, but peformance is, and writing more code than I have to is :)

Understood.

Actually, at some point I suppose I might be willing to add a RasterIOWithNoData()
that just calls down to the RasterIO() method.  It wouldn't be any more efficient
than what you are doing, but we could ensure all cases are taken care of properly
and it would save implementors some work.

> The other option might be to have an extended version of RasterIO which can do 
> the filtering.

Err, I guess I should have read one line further.

However, I am unlikely to implement this in the near future as I am pretty
busy just now.

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