0

I'm writting a pure Python lib to read VRT files and I'm struggling to understand a spec of the VRT format: https://gdal.org/drivers/raster/vrt.html.

When a source is added in a SimpleSource tag, on should add the positioning of the source with respect to the global VRT:

<SimpleSource>
  <SourceFilename relativeToVRT="1">utm.tif</SourceFilename>
  <OpenOptions>
      <OOI key="OVERVIEW_LEVEL">0</OOI>
  </OpenOptions>
  <SourceBand>1</SourceBand>
  <SourceProperties RasterXSize="256" RasterYSize="256" DataType="Byte" BlockXSize="128" BlockYSize="128"/>
  <SrcRect xOff="0" yOff="0" xSize="256" ySize="256"/>
  <DstRect xOff="0" yOff="0" xSize="256" ySize="256"/>
</SimpleSource>

but what is the source corner of the .vrt format ?

I tried bottom-left but it's not. I'm going to try the four others afterward but can anyone reference documentation where this is specified?

5
  • 1
    It seems to be top left from some experiments, but I can't find a reference in the docs: gdal.org/drivers/raster/vrt.html
    – Spacedman
    Commented Apr 10, 2023 at 12:50
  • after some testing I can confirm it's top-left. documentation seems to be missing though Commented Apr 10, 2023 at 12:51
  • 2
    Image pixels always start at top left, it's not just a GDAL convention. This is why the Y size in a geotransform (and world file) is a negative value (as pixel Y index increases, map Y coordinate decreases).
    – user2856
    Commented Apr 10, 2023 at 13:14
  • You can update the docs
    – Ian Turton
    Commented Apr 10, 2023 at 17:50
  • 1
    they beat me to it: github.com/OSGeo/gdal/pull/7577, I'll wait for a merge and publish it as an answer Commented Apr 10, 2023 at 21:58

1 Answer 1

0

The documentation have been updated: https://gdal.org/drivers/raster/vrt.html#vrtdataset

GeoTransform: This element contains a six value affine geotransformation for the dataset, mapping between pixel/line coordinates and georeferenced coordinates. Typically (geotransform[0], geotransform[3]) will be the (easting, northing) of the upper-left corner of the raster, geotransform[1] the horizontal resolution in geospatial coordinates/pixel, and geotransform[5] the vertical resolution in geospatial coordinates/pixel, as a negative value if the image is north-up oriented. See Affine GeoTransform for more details about that mapping.

so the origin will depend from your transform, in a typical image, x > 0, y < 0 means that origin is top-left.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.