3

I have four .xyz files with terrain data. I can convert them to TIFs in QGIS 3.4, but in either format, merging them fails. The merge output always has the X dimension of the merged rasters, but a Y dimension of only one pixel. This happens in QGIS 2.18, 3.2 and 3.4 and whatever settings I apply. Any idea how to solve this problem?

The input rasters look like this: input rasters

The output looks like this: output

10
  • 1
    Does this happens with the merge tools or virtual raster catalog? Are they the sametyp of file (geotif, for instance) Commented Jan 30, 2019 at 13:50
  • Yes, all files are of the same type. I tried it with geoTIF and with .XYZ. It happens with the merge tool. Commented Jan 31, 2019 at 20:42
  • 1
    Have you tried to build a Virtual Raster with the 4 rasters and then, export it into a new file ? Commented Jan 30, 2020 at 14:14
  • Additional details: Horizontal merge does work (for me), but vertical doesn't. Trying to build a virtual raster throws "gdalbuildvrt does not support positive NS resolution". Also SAGA "add raster values to points" fails.
    – Erik
    Commented Jan 30, 2020 at 14:17
  • 1
    @Saijin_Naib data.geobasis-bb.de/geobasis/daten/dgm/xyz - any four tiles which form a square should suffice
    – Erik
    Commented Jan 30, 2020 at 14:38

5 Answers 5

4
+100

(using QGIS 3.8.2)

I was able to merge 4 adjacent tiles from the link provided in the comment from @Erik using:

  • Warp (gdalwarp), in the QGIS toolbox, outputting them to .tif
  • Merge (gdal_merge), in the toolbox again.

I didn't have to change any settings, I left everything as default.

enter image description here

4
  • 2
    This is the same procedure as I used the first time. I just retried it - and it did work. What the heck?
    – Erik
    Commented Jan 30, 2020 at 15:43
  • @Erik Weird. I did try to built a VRT and it gave me the same NS values error, so it should be the same file structure.
    – Gabriel
    Commented Jan 30, 2020 at 16:04
  • 1
    Well, though technically you didn't solve the original problem, your answer shows how to do it correctly - and encouraged me to try again. So, while I can't mark you answer as correct, I can grant you the title "bountyhunter" =)
    – Erik
    Commented Feb 3, 2020 at 7:39
  • Well that was unexpected! I was sure someone would come in and point out the bug report that was at the bottom of this.
    – Gabriel
    Commented Feb 3, 2020 at 12:31
3

Your images have a positive N-S pixel resolution in the geotransform. This is quite unusual and means the origin coordinates for the image are in the lower-left rather than the upper-left of the image. In the usual upper-left case the geotransform N-S pixel resolution would be negative.

Are you sure your image georeferences are correct?

Try exporting all your raster as asciis and check the UL or LL settings for irregularities with your favourite text viewer.

1
  • The images are georeferenced correctly (I checked with the basemap).
    – Erik
    Commented Jan 30, 2020 at 14:50
3

this is not an answer to your question, but may solve your problem anyways. the rasters that you are trying to mosaic are also available as a WCS under this link: https://isk.geobasis-bb.de/ows/dgm_wcs You can just add the WCS to QGIS and use it for your processing.

1

You may try and convert those tiles to a virtual raster. Export this virtual raster then into a new .xyz file and you should be good!

1
  • Trying to build a virtual raster throws "gdalbuildvrt does not support positive NS resolution".
    – Erik
    Commented Jan 30, 2020 at 14:18
0

I encountered the issue (again) with the same data source.

Solved the issue by transforming the data to the same CRS, but with half the ground resolution (2m instead of 1m). Then merging worked.

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