最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

geoserver - How can I add a second layerGroup style using rest API? - Stack Overflow

programmeradmin1浏览0评论

We'd like to have two different styles for a given layer group and to be able to select styles using styles=STYLE_NAME in the URL. We found that it's doable by adding alternative layer group styles using Geoserver's UI like so:

First hit "Add new", then "Add Layer", then click on each layer and assign its alternative style and you're good. Everything works when we pass styles param in the group's URL.

Fine, now how to do that via API?

If I GET such a layer group I can see info about `layerGroupsStyles":

However, if I send a POST request with the following XML

<layerGroup>
    <name>my new group</name>
    <layers><layer><name>a new layer</name></layer></layers>
    <styles>
        <style>line</style>
    </styles>
    <layerGroupStyles>
        <LayerGroupStyle>
            <name>cockpit</name>
            <layers><layer><name>a new layer</name></layer></layers>
            <styles>
                <style>my_line_style</style>
            </styles>                
        </LayerGroupStyle>
    </layerGroupStyles>
</layerGroup>

then I get this error:

Unexpected item null whose type is not among: [interface .geoserver.catalog.LayerInfo, interface .geoserver.catalog.LayerGroupInfo]

Swagger does not help as there is no mention of layerGroupsStyles at all.

Any help is much appreciated as I can't, for the life of me, understand how and where to read about Geoserver's API.

Thanks!

发布评论

评论列表(0)

  1. 暂无评论