[Geoserver-users] Updating coverage store parameters via rest

Hi all,

I am uploading tiff files to geoserver via rest, using:

curl -u admin:geoserver -v -XPUT -H ‘Content-type: text/plain’
-d ‘file:’“ + imageLocation + ”/“ + imageName + ”
http://localhost:8080/geoserver/rest/workspaces/mag/coveragestores/imageName/external.geotiff?configure=first&coverageName=" + coverageName

and that works fine.

What I would like to do now is set the OutputTransparentColor as well, so that the black border of my images becomes transparent. (so setting it to 000000).

I saw this
http://osgeo-org.1560.x6.nabble.com/Reload-Mosaic-CoverageStore-Coverage-after-shp-properties-file-has-been-modified-td3803889.html

and at the bottom it says to do a REST PUT with all the parameters, however that doesn’t work for me. this is what I have tried.

curl -u admin:geoserver -v -XPUT -H “Content-type: text/xml” ‘AllowMultithreadingfalseOutputTransparentColorInputTransparentColor000000SUGGESTED_TILE_SIZEInputImageThresholdValueNaNBackgroundValues255USE_JAI_IMAGEREADtrue’ http://localhost:8080/geoserver/rest/workspaces/mag/coveragestores/imageName/coverages/LC82020242014096MTI00_B432_enh.xml

I’m getting an unresolved host error, it’s trying to read the ‘<coverage…’ etc bit:


  • getaddrinfo(3) failed for AllowMultithreading<:80
  • Couldn’t resolve host ‘AllowMultithreading<’
  • Closing connection #0
    curl: (6) Couldn’t resolve host ‘AllowMultithreading<’
  • About to connect() to localhost port 8080 (#0)
  • Trying 127.0.0.1… connected
  • Server auth using Basic with user ‘admin’

PUT /geoserver/rest/workspaces/mag/coveragestores/imageName/coverages/LC82020242014096MTI00_B432_enh.xml HTTP/1.1
Authorization: Basic YWRtaW46Z2Vvc2VydmVy
User-Agent: curl/7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
Host: localhost:8080
Accept: /
Content-type: text/xml

< HTTP/1.1 500 Internal Server Error
< Server: Apache-Coyote/1.1
< Transfer-Encoding: chunked
< Date: Wed, 13 Aug 2014 08:42:46 GMT
< Connection: close
<

  • Closing connection #0
    : input contained no data

any ideas would be most welcome.

thanks

toby

On Wed, Aug 13, 2014 at 10:48 AM, Tobias Reinicke <ramotswa@anonymised.com>
wrote:

Hi all,

I am uploading tiff files to geoserver via rest, using:

curl -u admin:geoserver -v -XPUT -H 'Content-type: text/plain' \
        -d 'file:'“ + imageLocation + ”/“ + imageName + ” \

http://localhost:8080/geoserver/rest/workspaces/mag/coveragestores/imageName/external.geotiff?configure=first\\&amp;coverageName=&quot;
+ coverageName

and that works fine.

What I would like to do now is set the OutputTransparentColor as well, so
that the black border of my images becomes transparent. (so setting it to
000000).

I saw this

http://osgeo-org.1560.x6.nabble.com/Reload-Mosaic-CoverageStore-Coverage-after-shp-properties-file-has-been-modified-td3803889.html
and at the bottom it says to do a REST PUT with all the parameters,
however that doesn’t work for me. this is what I have tried.

You forgot to add "-d" before the xml contents of your resource (and
possibly also a <enabled>true</enabled> in the
xml contents)

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Hi Andrea - yes that was it, thanks. I wanted to post an answer but didn’t want to spam the list.

It also turns out that I don’t have to specify every parameter, just the one I want - so this works:
“curl -u admin:geoserver -v -XPUT -H ‘Content-type: text/xml’ -d ‘InputTransparentColor000000true’ \”http://localhost:8080/geoserver/rest/workspaces/mag/coveragestores/imageName/coverages/“ + coverageName + ”.xml""

And yes, not about the “enabled” flag - not sure why updating the preferences 'disables’ the layer. Anyway - all good. Thanks
Toby

···

On 15 August 2014 15:43, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Wed, Aug 13, 2014 at 10:48 AM, Tobias Reinicke <ramotswa@anonymised.com.84…> wrote:

Hi all,

I am uploading tiff files to geoserver via rest, using:

curl -u admin:geoserver -v -XPUT -H ‘Content-type: text/plain’
-d ‘file:’“ + imageLocation + ”/“ + imageName + ”
http://localhost:8080/geoserver/rest/workspaces/mag/coveragestores/imageName/external.geotiff?configure=first&coverageName=" + coverageName

and that works fine.

What I would like to do now is set the OutputTransparentColor as well, so that the black border of my images becomes transparent. (so setting it to 000000).

I saw this
http://osgeo-org.1560.x6.nabble.com/Reload-Mosaic-CoverageStore-Coverage-after-shp-properties-file-has-been-modified-td3803889.html

and at the bottom it says to do a REST PUT with all the parameters, however that doesn’t work for me. this is what I have tried.

You forgot to add “-d” before the xml contents of your resource (and possibly also a true in the
xml contents)

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.

==

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it