Задача следующая: у нас будет в папке появляться quick lookи в формате GeoTIFF, нужно их добавить в GeoServer, но сделать это при помощи какого-нибудь скрипта (bash или что-нибудь в этом жанре), т.е. в этом процессе не должен участвовать человек, за исключение написания самого скрипта))). Бороздя просторы бескрайних вод интернета на моём любимом пароходе Google я наткнулся на вот этот ответ DaveParillo gis.stackexchange.com/questions/6479/programming-geoserver-2-0-2-to-add-a-raster-data-store-and-layer-without-the-ui. Но вот как штука, у меня выдается error при создания store. Вот мои запросы и ответы:
query:
Код: Выделить всё
zsumo@vm-geoportal:/opt/tomcat/webapps/geoserver/data$ curl -u admin:geoserver -v -XPOST -H 'Content-type: text/xml' -d '<workspaces><name>geotiff</name></workspaces>' http://192.168.255.197:8080/geoserver/rest/workspaces
Код: Выделить всё
* Hostname was NOT found in DNS cache
* Trying 192.168.255.197...
* Connected to 192.168.255.197 (192.168.255.197) port 8080 (#0)
* Server auth using Basic with user 'admin'
> POST /geoserver/rest/workspaces HTTP/1.1
> Authorization: Basic YWRtaW46Z2Vvc2VydmVy
> User-Agent: curl/7.35.0
> Host: 192.168.255.197:8080
> Accept: */*
> Content-type: text/xml
> Content-Length: 43
>
* upload completely sent off: 43 out of 43 bytes
< HTTP/1.1 201 Created
< Date: Thu, 10 Dec 2015 14:15:53 GMT
< Location: http://192.168.255.197:8080/geoserver/rest/workspaces/geotiff
* Server Noelios-Restlet-Engine/1.0..8 is not blacklisted
< Server: Noelios-Restlet-Engine/1.0..8
< Transfer-Encoding: chunked
<
* Connection #0 to host 192.168.255.197 left intact
query:
Код: Выделить всё
zsumo@vm-geoportal:/opt/tomcat/webapps/geoserver/data$ curl -u admin:geoserver -v -XPOST -H 'Content-type: text/xml' -d '<coverageStore><name>fff</name><enabled>true</enabled><type>GeoTIFF</type><url>/opt/tomcat/webapps/geoserver/data/avhrr_locale1e2.tif</url></coverageStore>' "http://192.168.255.197:8080/geoserver/rest/workspaces/geotiff/coveragestores?configure=all"
Код: Выделить всё
* Hostname was NOT found in DNS cache
* Trying 192.168.255.197...
* Connected to 192.168.255.197 (192.168.255.197) port 8080 (#0)
* Server auth using Basic with user 'admin'
> POST /geoserver/rest/workspaces/geotiff/coveragestores?configure=all HTTP/1.1
> Authorization: Basic YWRtaW46Z2Vvc2VydmVy
> User-Agent: curl/7.35.0
> Host: 192.168.255.197:8080
> Accept: */*
> Content-type: text/xml
> Content-Length: 155
>
* upload completely sent off: 155 out of 155 bytes
< HTTP/1.1 500 Internal Server Error
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Date: Thu, 10 Dec 2015 14:16:14 GMT
< Connection: close
<
* Closing connection 0
:Store must be part of a workspace
P.S. Проверил по докам GeoServer с shape файлами все тип-топ, lдобавляются как надо, но в оф. доках нету примеров для растров.
P.P.S. GeoServer v. 2.8.1.