Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using the geoserver api to find information about layers that are available. I am using:

http://localhost/geoserver/rest/layers.json

to get a dynamic list of all layers. If I then select a layer with:

http://localhost/geoserver/rest/layers/<myLayer>.json

I get information about the layer.

How can I determine the layers respective workspace?

share|improve this question
    
localhost/geoserver/rest/workspaces –  iant Jul 17 '13 at 14:57
add comment

1 Answer

From the layer, follow the link to the associated feature type

"resource":{"@class":"featureType","name":"ne_10m_populated_places","href":"http:\/\/scale.dev.opengeo.org\/geoserver\/rest\/workspaces\/naturalearth\/datastores\/ne\/featuretypes\/ne_10m_populated_places.json"}

then to the data store for that feature type

"store":{"@class":"dataStore","name":"ne","href":"http:\/\/scale.dev.opengeo.org\/geoserver\/rest\/workspaces\/naturalearth\/datastores\/ne.json"}

and then from there there's a link to the workspace

"workspace":{"name":"naturalearth","href":"http:\/\/scale.dev.opengeo.org\/geoserver\/rest\/workspaces\/naturalearth.json"}

You could also look at the path to the feature type which will include the workspace, although that's not quite as "correct" a method, it does save you from having to load all those extra resources.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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