| 2 | |
| 3 | The test raster can be downloaded at: |
| 4 | |
| 5 | [http://dev.calsurv.org/sft00.zip] |
| 6 | |
| 7 | The archive is too big to attach to this ticket. Sorry. |
| 8 | |
| 9 | The raster was loaded into PostgreSQL using |
| 10 | |
| 11 | {{{ |
| 12 | raster2pgsql -s 4326 -t 10x10 -I -C sft00.tif test_1808 | psql -d test |
| 13 | }}} |
| 14 | |
| 15 | If we focus on just one tile (rid=1108)... |
| 16 | |
| 17 | {{{ |
| 18 | gdalinfo --debug on -stats "PG:host=localhost dbname=test port=5432 user=postgres table=test_1808 where='rid=1108'" |
| 19 | }}} |
| 20 | |
| 21 | The output... |
| 22 | |
| 23 | {{{ |
| 24 | PostGIS_Raster: PostGISRasterDataset::GetConnectionInfo(): Mode: 1 |
| 25 | Schema: public |
| 26 | Table: test_1808 |
| 27 | Column: rast |
| 28 | Where: rid=1108 |
| 29 | Host: localhost |
| 30 | Port: 5432 |
| 31 | User: postgres |
| 32 | Password: |
| 33 | Connection String: host=localhost dbname=test port=5432 user=postgres |
| 34 | PostGIS_Raster: PostGISRasterDataset::SetRasterProperties(): Query: select cols.column_name from information_schema.constraint_column_usage as cols join information_schema.table_constraints as constr on constr.constraint_name = cols.constraint_name where cols.table_schema = 'public' and cols.table_name = 'test_1808' |
| 35 | PostGIS_Raster: PostGISRasterDataset::SetRasterProperties(): Query: select (foo.md).*, foo.rast from (select rast, st_metadata(rast) as md from public.test_1808 where rid=1108) as foo |
| 36 | PostGIS_Raster: PostGISRasterDataset::SetRasterProperties(): adfGeoTransform = {-75.784302, 0.204545, 0.000000, 77.680834, 0.000000,-0.204423} |
| 37 | PostGIS_Raster: PostGISRasterDataset::SetRasterProperties(): Raster size = (10, 10) |
| 38 | PostGIS_Raster: PostGISRasterDataset::SetRasterProperties(): Block dimensions = (10 x 10) |
| 39 | PostGIS_Raster: PostGISRasterRasterBand constructor: Band created (srid = 4326) |
| 40 | GDAL: GDALOpen(PG:host=localhost dbname=test port=5432 user=postgres table=test_1808 where='rid=1108', this=0x62f650) succeeds as PostGISRaster. |
| 41 | Driver: PostGISRaster/PostGIS Raster driver |
| 42 | Files: none associated |
| 43 | Size is 10, 10 |
| 44 | Coordinate System is: |
| 45 | GEOGCS["WGS 84", |
| 46 | DATUM["WGS_1984", |
| 47 | SPHEROID["WGS 84",6378137,298.257223563, |
| 48 | AUTHORITY["EPSG","7030"]], |
| 49 | AUTHORITY["EPSG","6326"]], |
| 50 | PRIMEM["Greenwich",0, |
| 51 | AUTHORITY["EPSG","8901"]], |
| 52 | UNIT["degree",0.0174532925199433, |
| 53 | AUTHORITY["EPSG","9122"]], |
| 54 | AUTHORITY["EPSG","4326"]] |
| 55 | Origin = (-75.784301562500005,77.680833536363593) |
| 56 | Pixel Size = (0.204545041250000,-0.204422967727273) |
| 57 | OGRCT: PROJ >= 4.8.0 features enabled |
| 58 | OGRCT: Source: +proj=longlat +datum=WGS84 +no_defs |
| 59 | OGRCT: Target: +proj=longlat +datum=WGS84 +no_defs |
| 60 | Corner Coordinates: |
| 61 | Upper Left ( -75.7843016, 77.6808335) ( 75d47' 3.49"W, 77d40'51.00"N) |
| 62 | Lower Left ( -75.7843016, 75.6366039) ( 75d47' 3.49"W, 75d38'11.77"N) |
| 63 | Upper Right ( -73.7388512, 77.6808335) ( 73d44'19.86"W, 77d40'51.00"N) |
| 64 | Lower Right ( -73.7388512, 75.6366039) ( 73d44'19.86"W, 75d38'11.77"N) |
| 65 | Center ( -74.7615764, 76.6587187) ( 74d45'41.67"W, 76d39'31.39"N) |
| 66 | Band 1 Block=10x10 Type=Float32, ColorInterp=Undefined |
| 67 | PostGIS_Raster: PostGISRasterRasterBand::IReadBlock: The query = select rid, rast from public.test_1808 where rast ~ st_setsrid(st_makebox2d(st_point(-75.784302, 75.636604), st_point(-73.738851,77.680834)),4326) and rid=1108 |
| 68 | PostGIS_Raster: PostGISRasterRasterBand::IReadBlock: The block (0, 0) is empty |
| 69 | Minimum=0.000, Maximum=0.000, Mean=0.000, StdDev=0.000 |
| 70 | Overviews: arbitrary |
| 71 | Metadata: |
| 72 | STATISTICS_MAXIMUM=0 |
| 73 | STATISTICS_MEAN=0 |
| 74 | STATISTICS_MINIMUM=0 |
| 75 | STATISTICS_STDDEV=0 |
| 76 | GDAL: GDALClose(PG:host=localhost dbname=test port=5432 user=postgres table=test_1808 where='rid=1108', this=0x62f650) |
| 77 | }}} |
| 78 | |
| 79 | The stats are incorrect as... |
| 80 | |
| 81 | {{{ |
| 82 | psql -d test -c "SELECT (ST_SummaryStats(rast)).* FROM test_1808 WHERE rid = 1108;" |
| 83 | |
| 84 | count | sum | mean | stddev | min | max |
| 85 | -------+-------------------+--------------------+-------------------+--------------------+------------------- |
| 86 | 100 | -16.9827570720809 | -0.169827570720809 | 0.449019653323118 | -0.888983130455017 | 0.503015160560608 |
| 87 | }}} |
| 88 | |
| 89 | This is on GDAL -trunk r24660, PostgreSQL 9.1.4 and PostGIS -trunk !r10037 |