[gdal-dev] Mixed coordinate systems in VRT?

Even Rouault even.rouault at spatialys.com
Wed Jan 20 13:55:40 PST 2016


Le mercredi 20 janvier 2016 22:37:41, Jim Lacy a écrit :
> I have an area of interest that is split across two UTM zones.  My desired
> end result is a single stitched, clipped, and re-projected image in a
> local coordinate system.
> 
> My usual workflow is to build a VRT that contain only the input tiles that
> touch the area of interest.  Normally that works great, but not when split
> across zones. I know it's possible to create a VRT containing two or more
> coordinate systems with the gdalbuildvrt  -allow_projection_difference
> option.
> 
> There are at least two ways I could proceed:
> 
> 
> A)     Two steps: reproject all input tiles to a common base with gdalwarp,
> then stitch/clip with gdalwarp -t_srs "EPSG:7645"  -cutline clip.shp
> -crop_to_cutline aoi.vrt output.tif  (where aoi.vrt contains a list of
> tiles that touch the AOI)
> 
> B)      One step:  gdalwarp -t_srs "EPSG:7645" mixed_utm_zones.vrt
> output.tif
> 
> "B" is  nice option in theory. However, in my experiments, it appears that
> only half the AOI is processed when I try.  Option "A" works fine, but it
> seems like the image would be resampled twice... once for each gdalwarp
> command?
> 
> Can anyone confirm if B is theoretically possible?  Better approaches? 
> This must be a common issue.

If there's an explicit switch to add to avoid a warning, generally it means 
"are you sure you know what you do ?" ;-)

And the doc indeed mentions :

<dt> <b>-allow_projection_difference</b>:</dt><dd> (starting with GDAL 1.7.0)
When this option is specified, the utility will accept to make a VRT even if 
the input datasets have
not the same projection. Note: this does not mean that they will be 
reprojected. Their projection will
just be ignored.
</dd>

The option is intended for files whose projection WKT is slightly different on 
not significant things, like minor differences in citations, typically coming 
from different formats, but the projection is fundamentally the same.

gdalwarp accepts several input datasets, so you could create 2 VRT for each 
utm zone and provide them to gdalwarp. Or you could just throw directly all 
the input datasets directly into gdalwarp. gdalwarp accepts input datasets in 
different projections.

> 
> Thanks for advice!
> 
> ----------------------------------------------
> Jim Lacy
> Wisconsin State Cartographer's Office
> University of Wisconsin-Madison
> (608) 262-6850
> www.sco.wisc.edu<http://www.sco.wisc.edu/>
> My calendar:  http://go.wisc.edu/xziys4

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list