I would like to add and publish hundreds of GeoTIFFs to my GeoServer datastore. I have started to write a batch file to manage GeoServer by REST API. I have finally figured out how to create a new workspace and datastore. But do not know how to add hundreds of GeoTIFFs from a local folder. I have tried to use a loop and wildcards.I cannot figure it out.
For the following code I got the error message:
curl: no URL specified!
curl: try 'curl --help' for more information
uebung1.bat: line 28: http://loclahost:8080/geoserver/rest/workspaces/DPP/datastores/BarometricPressure: No such file or directory
mat80localhost 138 <.../TERENO_StationViewer/batch>:
Here is the batch-code:
#!/bin/bash
curl -u admin:geoserver -v -XGET -H 'Accept: text/xml'\
"http://loclahost:8080/geoserver/rest/workspaces"
echo ""
echo ""
echo ""
curl -u admin:geoserver -v -XPOST -H 'Content-type: text/xml' \
-d '<workspace><name>DDP</name></workspace>'\
"http://localhost:8080/geoserver/rest/workspaces"
echo "----- Then create the datastore. ------------------------------------"
echo ""
curl -u admin:geoserver -v -XPOST -H 'Content-type: application/xml' \
-d '<coverageStore><name>BarometricPressure</name><workspace>DDP</workspace>
<enabled>true</enabled>
<type>GeoTIFF</type>
<url>/misc/klima2/monitoring/climate_data/raster/BarometricPressure/2014/</url>
</coverageStore>'\
"http://localhost:8080/geoserver/rest/workspaces/DDP/coveragestores?configure=all"
echo ""
echo ""
curl -u admin:geoserver -v -XGET -H 'Accept: text/xml'\
http://localhost:8080/geoserver/rest/workspaces
echo ""
echo ""
for f in *tif; do
curl -u admin:geoserver -v -XPUT -H 'Content-Type: image/tiff' \
-d "$f %.tif"
"http://localhost:8080/geoserver/rest/workspaces/DPP/datastores/BarometricPressure";
Aucun commentaire:
Enregistrer un commentaire