[gdal-dev] gdal.AutoCreateWarpedVRT returning different results than osr.CoordinateTransformation

Billy Newman newmanw10 at gmail.com
Sat May 5 16:19:26 EDT 2012


Frank,

Thanks so mush for the quick response.

One more quick question.  I am grabbing the metadata from my image files to
store in the database as an index of where my imagery lives.  I server out
my images in EPSG:4326 so that is how I would like to store the metadata
(bounding box) of the images.  However I am not really sure how to
calculate the metadata for EPSG:4326 in a timely manner.

I.E. if I just pull the metadata from the image file (without reading the
image itself) and convert the corner point to EPSG:4236 with
CoordinateTransformation I will save some time by not reading the file.
However when I serve out the image I need to use gdalwarp to warp the image
to EPSG:4326.  So the metadata I store in the db does not match the 'real'
warped image's metadata.

I can use gdalwarp on each image then pull the metadata but I assume that
amount of processing on each image just to get the metadata is going to be
a lot slower than just using CoordinateTransformation.

I index millions of images so the index (pulling the metadata) needs to be
somewhat fast.

Can you think of a way that I can get the same metadata as gdalwarp would
give for a warped image without actually warping the image?

Thanks

On Fri, May 4, 2012 at 11:23 PM, Frank Warmerdam <warmerdam at pobox.com>wrote:

> On 12-05-04 03:39 PM, Billy Newman wrote:
>
>> I ran a quick test and confirmed that gdal.AutoCreateWarpedVRT is
>> returning
>> different results than osr.CoordinateTransformation.
>>
>> I.E. I opened a file using:
>> Dataset dataset = gdal.Open("/images/image.tif")**;
>>
>> I grabbed the corner point and used
>> osr.CoordinateTransformation.**TransformPoint(), to transform the point
>> into
>> EPSG:4326.
>>
>> I warped the dataset using gdal.AutoCreateWarpedVRT, grabbed the corner
>> point
>> and the corner point was a little different.
>>
>> I am not sure if that is expected behavior or not.  Hopefully I am just
>> missing
>> some static files and one of the transformations was not quite right.  I
>> tried
>> all the different sampling algos available for the AutoCreateWarpedVRT
>> and that
>> did not make a huge difference.
>>
>> Is warp using a different method to transform the points?  If so is that
>> transformation available via the API?
>>
>> I understand that not all calcs may be exact between these two but I would
>> expect the corner point to be almost exact.
>>
>
> Billy,
>
> Generally speaking the extents of the warped VRT will be somewhat larger
> than the original to capture the irregular shape of the source image after
> warping into the target coordinate system.
>
> Best regards,
> --
> ------------------------------**---------+--------------------**
> ------------------
> I set the clouds in motion - turn up   | Frank Warmerdam,
> warmerdam at pobox.com
> light and sound - activate the windows | http://home.gdal.org/warmerda
> and watch the world go round - Rush    | Geospatial Software Developer
>
> ______________________________**_________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/**mailman/listinfo/gdal-dev<http://lists.osgeo.org/mailman/listinfo/gdal-dev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120505/e830e8a6/attachment.html


More information about the gdal-dev mailing list