I use the PostGIS-build-in raster2pgsql to load SAGA-raster into the db. I tried to grid them into 100x100-tiles, just as seen in the code:
/usr/lib/postgresql/9.2/bin/raster2pgsql -s 32632 -a -F -Y ~/Desktop/examplerast.sdat -t 100x100 import.exampletable | psql testrun -h localhost -p 5432 -U dbmaster
The strange thing is, that tiles in PostgreSQL/PostGIS have doubled dimensions: 200x200; as can be seen here:
select st_asewkt(st_envelope(rast)) from grids.exampletable limit 1;
SRID=32632;POLYGON((589203.15 5954785.35,589203.15 5954787.35,589205.15 5954787.35,589205.15 5954785.35,589203.15 5954785.35)) (1 row)
In order to achieve the desired 100x100-tiles I have to load them with a dimension -t 50x50
Why this doubling of dimensions? How to get rid of it? Thanks in advance!
1 Answer 1
What is the the output of
SELECT ST_Metadata(rast) FROM gids.exampletable LIMIT 1
The -t flag of raster2pgsql dictates the number of pixels along the X and Y axes for each tile. For your -t of 100x100, each tile will have dimensions of 100 x 100 or less.
-
Thanks a lot! This explains the trick pretty well, because I'm using a raster-resolution of 0.02m.knutella– knutella2013年04月11日 21:38:47 +00:00Commented Apr 11, 2013 at 21:38