如何使用GeoServer发布PostGIS栅格?
我花了很多时间尝试使用Image Mosaic JDBC创建Raster数据源,但是没有运气。
执行的步骤:
1.下载并安装JDBC Image Mosaic扩展(正常)
2.创建“连接参数”文件:
connect.postgis.xml.inc:
<connect>
<dstype value="DBCP"/>
<username value="postgres" />
<password value="password" />
<jdbcUrl value="jdbc:postgresql://localhost:5432/db1" />
<driverClassName value="org.postgresql.Driver"/>
<maxActive value="10"/>
<maxIdle value="0"/>
</connect>
mapping.postgis.xml.inc:
<spatialExtension name="postgis"/>
<mapping>
<masterTable name="mosaic" >
<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" />
</tileTable>
</mapping>
osm.postgis.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE ImageMosaicJDBCConfig [
<!ENTITY mapping PUBLIC "mapping" "mapping.postgis.xml.inc">
<!ENTITY connect PUBLIC "connect" "connect.postgis.xml.inc">]>
<config version="1.0">
<coverageName name="gfm"/>
<coordsys name="EPSG:25832"/>
<!-- interpolation 1 = nearest neighbour, 2 = bilinear, 3 = bicubic -->
<scaleop interpolation="1"/>
<verify cardinality="false"/>
&mapping;
&connect;
</config>
其中“ mosaic”是一个表(列:名称,标题表,minX,minY,maxX,maxY,resX,resY),其中包含一行:“ gfm,testrastertable 、、、、、、、、”
。3.将配置文件保存在中。 ./geoserver/data_dir/coverages/
4.在尝试添加Image Mosaic JDBC数据存储时,出现以下错误:
Error: Could not list layers for this store, an error occurred retrieving them: Unable to acquire a reader for this coverage with format: ImageMosaicJDBC
更新:Geoserver日志
2012-10-24 14:09:11,404 DEBUG [org.geoserver] - Thread 14 locking in mode WRITE
2012-10-24 14:09:11,404 DEBUG [org.geoserver] - Thread 14 got the lock in mode WRITE
2012-10-24 14:09:11,406 DEBUG [geoserver.config] - Persisting coverage store raster_store
2012-10-24 14:09:11,408 DEBUG [geoserver.config] - Persisted org.geoserver.catalog.impl.CoverageStoreInfoImpl to /opt/geoserver/data_dir/workspaces/raster/raster_store/coveragestore.xml
2012-10-24 14:09:11,416 DEBUG [geoserver.config] - Persisted $Proxy15 to /opt/geoserver/data_dir/global.xml
2012-10-24 14:09:11,438 ERROR [imagemosaic.jdbc] -
2012-10-24 14:09:11,438 WARN [imagemosaic.jdbc] -
java.io.IOException
at org.geotools.gce.imagemosaic.jdbc.ImageMosaicJDBCReader.<init>(ImageMosaicJDBCReader.java:163)
at org.geotools.gce.imagemosaic.jdbc.ImageMosaicJDBCFormat.getReader(ImageMosaicJDBCFormat.java:209)
....
2012-10-24 14:09:11,439 INFO [geoserver.web] - Getting list of coverages for saved store file:coverages/osm.postgis.xml
java.lang.RuntimeException: Could not list layers for this store, an error occurred retrieving them: Unable to acquire a reader for this coverage with format: ImageMosaicJDBC
at org.geoserver.web.data.layer.NewLayerPageProvider.getItems(NewLayerPageProvider.java:115)
...
Caused by: java.lang.Exception: Unable to acquire a reader for this coverage with format: ImageMosaicJDBC
at org.geoserver.catalog.CatalogBuilder.buildCoverage(CatalogBuilder.java:812)
at org.geoserver.web.data.layer.NewLayerPageProvider.getItems(NewLayerPageProvider.java:82)
... 95 more
2012-10-24 14:09:11,441 DEBUG [geoserver.config] - Removing coverage store raster_store
2012-10-24 14:09:11,446 DEBUG [geoserver.config] - Persisted $Proxy15 to /opt/geoserver/data_dir/global.xml
2012-10-24 14:09:11,459 DEBUG [org.geoserver] - Thread 14 releasing the lock in mode WRITE