2

I'm parsing layers from a catalog and I would like to edit metadata links directly from the code.

Until now, I tried:


cat = Catalog("http://localhost:8080/geoserver/", XX, YYY)
layers = cat.get_layers()
for layer in layers:
    lyr = cat.get_layer("layer_name")
    lyr.resource.metadata_links.append(('text/html', 'other', 'metadata.html'))
    cat.save(lyr)

---- EDIT ----- Found out the answer, see below.

2

I found out by myself investigating class and methods structure: to do it we've to get the resource. Doc here.


cat = Catalog("http://localhost:8080/geoserver/", XX, YYY)
layers = cat.get_layers()
for layer in layers:
    rsc = cat.get_resource("layer_name",
                           store=layer.resource._store.name)
    rsc.metadata_links= [('text/html', 'other', 'metadata.html'),]
    cat.save(rsc)

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.