geoserver API设置图层样式

https://www.cnblogs.com/Mr-Kahn/p/12850742.html

https://www.osgeo.cn/geoserver-user-manual/rest/index.html#rest

python示例

# xml方式
auth = ('admin', 'geoserver')
response = requests.put('http://localhost:9090/geoserver/rest/layers/seaice:ice_thickness_1020',
                      headers={'Content-Type': 'application/xml'},
                      data=f"<layer><defaultStyle><name>seaice:wave</name></defaultStyle></layer>",
                      auth=auth)

# json方式
data = json.dumps({
    "layer": {
        "defaultStyle": {
            "name": "seaice:wave"
        }
    }
})
 response = requests.put('http://localhost:9090/geoserver/rest/layers/seaice:ice_thickness_1020',
                      headers={'Content-Type': 'application/json'},
                      data=data,
                      auth=auth)


posted @ 2023-11-28 17:26  槑孒  阅读(173)  评论(0)    收藏  举报