So, simple thing as it seems but I can't seem to make it work! I'm trying to add a raster data file (GeoTIFF) to geoserver via REST API, using curl on linux. REST API is working, since I created a new workspace using it:
curl -u admin:geoserver -v -XPOST -H 'Content-type: text/xml' \
-d 'restProba ' \
http://localhost:8080/geoserver/rest/workspaces
It's correctly created as shown by Geoserver's admin ui, but when I try to add a coveragestore to that workspace by executing
curl -u admin:geoserver -v -XPOST -H 'Content-type: text/xml' -d
'int_dec true
GeoTIFF $home/int_dec.tif '
"http://localhost:8080/geoserver/rest/workspaces/restProba/coveragestores?configure=all"
even though it is correctly loaded, it goes directly into the default workspace, which is not the one I want it in. Is there any way of defining which workspace i want it in? I thought it'd enough by mentioning it in the URL where I point to restProba's workspace URI but it seems to be omiting it.
Thanks for your help :-)
pd: newbie with geoserver, I've tried searching for this but either i'm not using the correct search criteria, im a fool or it's just too simple for anyone to ask that i'm even fooler for asking it :p
Answer
Maybe you can try this after creating the workspace:
curl -u admin:geoserver -v -XPOST -H 'Content-Type: application/xml' \
-d 'int_dec restProba
true ' \
http://localhost:8080/geoserver/rest/workspaces/restProba/coveragestores
It should create a coveragestore called int_dec
in the restProba
workspace::
You can then reference the GeoTIFF file:
curl -u admin:geoserver -v -XPUT -H 'Content-type: text/plain' \
-d 'file:/$home/int_dec.tif' \
http://localhost:8080/geoserver/rest/workspaces/restProba/coveragestores/int_dec/external.geotiff?configure=first\&coverageName=int_dec
I think your problem is the missing '
Your request was:
curl -u admin:geoserver -v -XPOST -H 'Content-type: text/xml' -d
' int_dec true GeoTIFF $home/int_dec.tif
"http://localhost:8080/geoserver/rest/workspaces/restProba/coveragestores?configure=all"
It should've been:
curl -u admin:geoserver -v -XPOST -H 'Content-type: text/xml' -d
'' int_dec true GeoTIFF $home/int_dec.tif
"http://localhost:8080/geoserver/rest/workspaces/restProba/coveragestores?configure=all"
No comments:
Post a Comment