Using GeoServer Rest API, I have uploaded a 4 band Geotiff image in a coverage store. But I can't seem to find the right request to create a CoverageView from this geotiff, choosing which band this CoverageView will have, although I can do it from GeoServer interface.
Could anyone point me in the right direction ?
Like in this post, I created a coverage store and uploaded my geotiff. To create the coverage view, I send this query, using httr package in R :
r = POST( url = "http://localhost:8080/geoserver/rest/workspaces/my_workspace/coveragestores/my_coverage_store/coverages", config = authenticate(id, password), add_headers(.headers = c("Content-Type" = "text/xml")), body = body)
and the xml body :
<coverage> <name>my_coverage_store</name> <nativeName>my_coverage_store</nativeName> <metadata> <entry key=\"COVERAGE_VIEW\"> </entry> </metadata> </coverage>
And with content(r) I get this error :
"java.lang.String cannot be cast to org.geoserver.catalog.CoverageView"
Alternatively, another answer for my problem would be to define a sld or css style where I can choose which band to display and specify that no alpha band should be used. So far I wasn't able to do that since in the openlayers preview of my layer using JPEG is OK, but with PNG the 4th band is set as an alpha band.