[Gdal-dev] gdal_translate image grow

Frank Warmerdam warmerdam at pobox.com
Thu Mar 30 09:10:58 EST 2006


Norman Barker wrote:
> Hi,
>
> I am using gdal_translate as the ‘engine’ behind mod_python as a very 
> simple WMS (so that I can prototype a few ideas before putting them into 
> MapServer), everything works fine until I specify a BBOX such that the 
> extents are outside that of the requested image.  This corresponds to 
> the –projwin option of gdal_translate, executing this I then get an 
> error “–srcwin falls outside of raster size”.
> 
> Is there a way to grow the output image and fill in the missing data?
> 
> So for example  
> 
> gdal_translate -not_strict -OF PNG -a_nodata 0 -projwin -180 90 180 -90 
> -outsize 836 654 inputimage outputimage
> 
> would give an output image with world extents, and somewhere in this 
> image would be the inputimage
> 
> Alternatively is there a way to do this with the python bindings or any 
> other utility.  I like gdal_translate since it does the conversion and 
> sampling in one go!

Norman,

If you were willing to limit yourself to directly creatable formats,
you could use gdalwarp to do this.  It supports an output file with a
larger region than the input.  Alternatively a few modifications could
be made to gdal_translate to support a projwin (or srcwin) that is larger
than the source.

Another approach would be for you to prepare a VRT file as input to
gdal_translate in your VRT script that has the characteristics you want
relative to the original file.  When you subwindow or do other such
transformations in gdal_translate it actually creates a "VRT" image of
the desired output file and uses that for input to translation.  To get
an idea what these VRTs look like you can even do a gdal_translate to
VRT format and you will get the VRT skeleton it created.

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    | President OSGF, http://osgeo.org




More information about the Gdal-dev mailing list