3

I want to automate the process of creating workspaces and image mosaics by using gsconfig.

First I defined the list of new work spaces to be created.

f_workspace = list(set(lst_fold).difference(set(lst)))

Then, from the list (if not empty) I create workspaces. Then I create new image mosaics. Everything works perfectly. However, I would like to assign another workspace to each new image mosaic? The name of the workspace and the folder name where the granules and the configuration files for IM are located are the same (ws). So, I want every image mosaic (ws) to be assigned a workspace (ws). Can somebody help me?

if not f_workspace:
    print("The list is empty!")
else:
    for ws in f_workspace:
        cat.create_workspace(ws,'http://localhost:8080/geoserver/'+ws)

        cat_wrksp = Catalog("http://localhost:8080/geoserver/rest", username="****", password="****")
        cat_wrksp.create_imagemosaic(ws, "/var/lib/tomcat8/webapps/geoserver/data/coverages/"+ws)
4

I solved the problem.

cat_wrksp.create_imagemosaic(ws, "/var/lib/tomcat8/webapps/geoserver/data/coverages/"+ws, workspace=ws)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.