I follow http://docs.geotools.org/latest/userguide/library/coverage/pgraster.html to publish a ImageMosaicJDBC layer in geoserver. the layer seems published ok and saved, but the preview of this layer does not give me a meaningful overview image, only a blank image with the correct lat lon extent. Also I don’t know why I got two bands when I get feature info, the geotiff that goes into postgis raster table only has one band. In the contrast, using Quantum GIS Lisboa I can see greyscale image after adding layer for the Postgis raster table in postgres.
below is what I have done:
step 1: Translate netCDF into GeoTiff:
$ gdal_translate.exe -of GTiff -scale -32766 32766 -32766 32766 -ot INT16 gebco_08_-12_-51_11_54.nc gebco08part2.tif
step 2: Load GeoTiff into Postgres as PostGIS raster table:
C:\temp>"C:\Program Files\PostgreSQL\9.2\bin\raster2pgsql.exe" -s 4326 -I -C -M gebco08part2.tif | "C:\Program Files\PostgreSQL\9.2\bin\psql.exe" -d postgis20 -U postgres
step 3: Create master table and tile table in Postgres:
create table gebco_master2 (NAME varchar(254) not null,
TileTable varchar(254)not null,
minX FLOAT8,minY FLOAT8, maxX FLOAT8, maxY FLOAT8,resX FLOAT8, resY FLOAT8,
primary key (NAME,TileTable))
insert into gebco_master2(NAME,TileTable) values ('gebco_cover','gebco08part2')
step 4: Configure mosaic JDBC plugin in geoserver:
gebco.pgraster.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE ImageMosaicJDBCConfig [
<!ENTITY mapping PUBLIC "mapping" "mapping.pgraster.xml.inc">
<!ENTITY connect PUBLIC "connect" "connect.pgraster.xml.inc">
]>
<config version="1.0">
<coverageName name="gebco_cover"/>
<coordsys name="EPSG:4326"/>
<scaleop interpolation="1"/>
&mapping;
&connect;
</config>
connect.pgraster.xml.inc:
<connect>
<!-- value DBCP or JNDI -->
<dstype value="DBCP"/>
<!-- <jndiReferenceName value=""/> -->
<username value="postgres" />
<password value="password" />
<jdbcUrl value="jdbc:postgresql://localhost:5432/postgis20" />
<driverClassName value="org.postgresql.Driver"/>
<maxActive value="10"/>
<maxIdle value="0"/>
</connect>
mapping.pgraster.xml.inc:
<spatialExtension name="pgraster"/>
<mapping>
<masterTable name="gebco_master2" >
<coverageNameAttribute name="name"/>
<maxXAttribute name="maxx"/>
<maxYAttribute name="maxy"/>
<minXAttribute name="minx"/>
<minYAttribute name="miny"/>
<resXAttribute name="resx"/>
<resYAttribute name="resy"/>
<tileTableNameAtribute name="tiletable" />
</masterTable>
<tileTable>
<blobAttributeName name="rast" />
<keyAttributeName name="rid" />
</tileTable>
</mapping>
step 5: Then add ImageMosaicJDBC store and layer in geoserver: URL Connection Parameters: file:coverages/gebco.pgraster.xml
I believe the postgis raster table in postgres database should be correct otherwise quantum gis won't be able to view it, the question is have I configured geoserver correctly, why the preview image is blank?