2

Is there a way to get the name of the Store that the layer belongs using gsconfig?

I have two different Stores registered in my geoserver and I need programmatically to be able to know which store each layer belongs to.

In the gsconfig documentation I see there is a get_store function but it accepts as argument only the store name (or the workspace).

1 Answer 1

1

I wrote a small function in python to do this. Essentially if you get the resource base then you can get the name of the store as:

def get_store_name(layer_name, workspace):
  # get the name of the store
  cat = Catalog(location, user, pass)
  resource = cat.get_resource(layer_name, workspace)
  store_name = resource.store.name
  return store_name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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