I am using:
- PostgreSQL 9.5
- PostGIS 2.2.1
- GDAL 1.11.3
I have two raster files:
-rw-rw-r-- 1 jlandercy jlandercy 1,3G Aug 25 21:02 contour_raster.dem
-rw-rw-r-- 1 jlandercy jlandercy 2,0G Sep 7 17:42 contours.dem
The second is the result of:
gdalwarp contour_raster.dem contours.dem
I would like to understand what it has done, files are different:
- in size;
- in structure;
- and behave differently when I import them into PostgreSQL.
If I compare their gdalinfo
using diff
:
2,3c2,3
< Files: contour_raster.dem
< Size is 22807, 22715
---
> Files: contours.dem
> Size is 22810, 22718
24,26c24,27
< GeoTransform =
< 138103.531187929, 1.000005446, -0.000117871259
< 181238.971718448, -0.000116195632, -1.000007394
---
> Origin = (138100.853742280829465,181238.971718448010506)
> Pixel Size = (1.000000000000000,-1.000000000000000)
> Metadata:
> AREA_OR_POINT=Area
28d28
< COMPRESSION=LZW
31,36c31,36
< Upper Left ( 138103.531, 181238.972) ( 4d11'53.62"E, 50d56'30.71"N)
< Lower Left ( 138100.854, 158523.804) ( 4d11'56.13"E, 50d44'15.61"N)
< Upper Right ( 160910.655, 181236.322) ( 4d31'21.79"E, 50d56'30.69"N)
< Lower Right ( 160907.978, 158521.154) ( 4d31'19.23"E, 50d44'15.60"N)
< Center ( 149505.755, 169880.063) ( 4d21'37.69"E, 50d50'23.56"N)
< Band 1 Block=128x128 Type=Float32, ColorInterp=Gray
---
> Upper Left ( 138100.854, 181238.972) ( 4d11'53.49"E, 50d56'30.71"N)
> Lower Left ( 138100.854, 158520.972) ( 4d11'56.13"E, 50d44'15.52"N)
> Upper Right ( 160910.854, 181238.972) ( 4d31'21.80"E, 50d56'30.78"N)
> Lower Right ( 160910.854, 158520.972) ( 4d31'19.38"E, 50d44'15.59"N)
> Center ( 149505.854, 169879.972) ( 4d21'37.70"E, 50d50'23.56"N)
> Band 1 Block=22810x1 Type=Float32, ColorInterp=Gray
The original raster has GeoTransform
the other is in pixel
(I don't know exactly what it means). Bounding Boxes are different, and Band is not encoded in the same way.
Further more if I use raster2pgpsql -C -t 1000 1000
to square rasters and insert tiles, the first file lacks constraints that cannot be set:
enforce_same_alignment_rast
;enforce_scalex_rast
;enforce_scalex_rast
.
My questions are:
- Why files do not have the same size (is it because of
COMPRESSION=LZW
)? - What is the difference between the two formats (alignment problem due to coordinate system)?
- Why bounding boxes are different?
- Why constraints fail in the first case?