GeoServer ImageMosaic PostGIS索引更新


11

我使用GeoServer在此手册下创建ImageMosaic存储的位置。当我创建一个新的数据存储时,所有*.tif文件都被索引到数据库(带PostGIS的PostgreSQL)中。当我将新的geotiff放入我的数据文件夹,或在数据库中重新索引所有geotiff文件时,如何在数据库中创建新的索引条目?

我的配置文件:

datastore.properties:

SPI=org.geotools.data.postgis.PostgisNGDataStoreFactory
host=localhost
port=5432
database=GeoServerRaster
schema=public
user=geoserver
passwd=*******
Loose\ bbox=true
Estimated\ extends=false
validate\ connections=true
Connection\ timeout=10
preparedStatements=true

indexer.properties:

Caching=false
TimeAttribute=ingestion
ElevationAttribute=elevation
Schema=*the_geom:Polygon,location:String,ingestion:java.util.Date,elevation:Integer
PropertyCollectors=TimestampFileNameExtractorSPI[timeregex](ingestion),DoubleFileNameExtractorSPI[elevationregex](elevation)

timeregex.properties:

regex=[0-9]{8}T[0-9]{6}Z(\?!.\*[0-9]{8}T[0-9]{6}Z.\*)

levationregex.properties:

regex=(?<=_)(\\d{1,5})(?=_)

目录中的文件:

tc_10000_20140807T033115Z.tif
tc_10000_20140807T040046Z.tif
tc_10000_20140807T043115Z.tif
...

Answers:


5

恕我直言,最好的方法是通过REST使用curl命令。

要为整个现有ImageMosaic重新编制索引,请使用以下命令(记住要设置正确的用户名,密码,工作空间名称,ImageMosaic存储名称以及granules目录的路径):

curl -v -u username:password -XPOST -H "Content-type: text/plain" \
 -d "file:///path/to/your/image/mosaic/directory/" \
 "http://localhost:8080/geoserver/rest/workspaces/YOUR_WORKSPACE/coveragestores/YOUR_IMAGEMOSAIC_STORE/external.imagemosaic"

这将从当前索引中删除所有颗粒,然后一个一个地添加现有文件。这非常耗时。

我更喜欢添加单个颗粒(即1个栅格文件):

curl -v -u username:password -XPOST -H "Content-type: text/plain" \
 -d "file:///path/to/your/image/mosaic/directory/and/your/granule.tiff" \
 "http://localhost:8080/geoserver/rest/workspaces/YOUR_WORKSPACE/coveragestores/YOUR_IMAGEMOSAIC_STORE/external.imagemosaic"

两个示例均假定栅格文件已经存在于指定位置(由external.imagemosaicURL的末尾指定)。

更多示例在GeoServer文档中


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.