GeoServer – How to Create Layer Group in GeoServer with GSConfig geoservergeoserver-rest-apipython How can I create layer groups using python gsconfig ? Best Answer 1. Connect to Catalog cat = Catalog("http://localhost:8080/geoserver/rest","admin", "geoserver") 2. Get some layers and styles lyrs = [list of layers] stls = [list of styles] 3. Create the group layer lg = cat.create_layergroup(groupname) 4. Add the layers and styles to the group layer lg.layers = lyrs lg.styles = stls 5. Save the group layer cat.save(lg) To specify a workspace I think you need to create a resource and then use that to create the group layer in step 3. myResource = cat.get_resources(workspace='workspaceName') lg = cat.create_layergroup(myResource,groupname Related Solutions[GIS] Python Geoserver gsconfig create resource from Postgis store table Bit late to the party, but I'll answer anyway 1. Connect to GeoServer cat = Catalog('http://localhost:8080/geoserver/rest') 2. Create a Workspace ws = cat.create_workspace('newWorkspaceName','newWorkspaceUri') 3. Create PostGIS store ds = cat.create_datastore(newDatastoreName,newWorkspaceName) ds.connection_parameters.update(host='localhost', port='5432', database='postgis', user='postgres', passwd='password', dbtype='postgis', schema='postgis') cat.save(ds) 4. Add Layer ft = cat.publish_featuretype('newLayerName', ds, 'EPSG:4326', srs='EPSG:4326') cat.save(ft) [GIS] How to get layers from a specific store of geoserver using python gsconfig Try defining the resource first and pulling the layers from it: myResource = cat.get_resources(store='storeName', workspace='workspaceName') layers = cat.get_layers(myResource) Related Question[GIS] How to configure a available feature types in GeoServer using python gsconfig
Best Answer
1. Connect to Catalog
2. Get some layers and styles
3. Create the group layer
4. Add the layers and styles to the group layer
5. Save the group layer
To specify a workspace I think you need to create a resource and then use that to create the group layer in step 3.