Importing tiles with raster2pgsql

Andreas B <[email protected]>
Newsgroups gmane.comp.gis.postgis
Message-ID <CAL2+-iVk_EH71XzBoFew3ckigpENLE+oqLy+4hip3=AgE+XF4A@mail.gmail.com>
Hi all,

I have a dataset with several hundred tiles (GeoTIFFs) that make up a
digital terrain model.
Each tile is 0.5d x 0.5d.

I tried to load these GeoTIFFs to PostGIS with:

$ raster2pgsql -s 32631 -I -M -F -C -t auto -d -l 2,4,8,16,32 tif/*.tif (1)

The data was loaded, but when viewing in QGIS, it looked like jagged lines
with areas of white overlain by pieces of neighboring tiles, etc.
This didn't look right.
I also noticed that for each tif, the constraints were printed.
I expected this to be done once, after the last tile was loaded.

I then created a virtual raster with gdalbuildvrt:

$ gdalbuildvrt merge.vrt tif/*.tif (2)

And then used raster2pgsql to load in the vrt:

$ raster2pgsql -s 32631 -I -M -F -C -t auto -d -l 2,4,8,16,32 merge.vrt |
psql (3)

The data was loaded, and looked good in QGIS.

Shouldn't commands (1) and (3) give the same results, or am I
misunderstanding?

Best, Andreas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.