[Gdal-dev] gdal_translate image grow
Norman Barker
nbarker at rsinc.com
Mon Apr 3 11:33:00 EDT 2006
-----Original Message-----
From: Frank Warmerdam [mailto:fwarmerdam at gmail.com] On Behalf Of Frank
Warmerdam
Sent: Thursday, March 30, 2006 3:11 PM
To: Norman Barker
Cc: gdal-dev at lists.maptools.org
Subject: Re: [Gdal-dev] gdal_translate image grow
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,
--
<snip>
Hi,
I have managed to get this working with VRT raster files, they are
seriously cool and I can program them from python forming a basic WMS.
However when I sample from a smaller image to a larger image with
greater spatial extents I use a kernel filter. It seems that the kernel
filter doesn't stop in the y-axis and continues for the length of the
image (see attached).
Is this something that anyone else has come across? Also how do I make
the output png have transparent values, I have tried -a_nodata 0?
Many thanks,
Norman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 6631 bytes
Desc: test.png
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20060403/b7ae5163/test.png
More information about the Gdal-dev
mailing list