2

Using the web admin page, I created two layers in different workspace but with the same name:

In the admin view I see something as this

Workspace  Store        Layer Name
WK1        PostGIS1     mylayer
WK2        PostGIS2     mylayer

All works very well, except when I try to access the properties of these layers with Geoserver REST API.

/layers.xml give me something like:

<layer><name>mylayer</name><atom:link rel="alternate" href="http://localhost:8080/geoserver/rest/layers/mylayer.xml" type="application/xml"/></layer>
<layer><name>mylayer</name><atom:link rel="alternate" href="http://localhost:8080/geoserver/rest/layers/mylayer.xml" type="application/xml"/></layer>

Two identical entries! And when I ask for the layer with /layers/mylayer.xml I only get the properties of the first...

How can I access the properties of the second layer with the REST API? Can it be done or it's a limitation or a bug of the REST API?

1
  • I'm using Geoserver 2.4.4, but haven't seen any differences in the REST API documentation in version 2.6
    – jeb
    Jul 3, 2014 at 20:51

1 Answer 1

4

Could be - it would be useful if /geoserver/rest/layers returned the workspace qualified names, such as:

<layer><name>mylayer</name><atom:link rel="alternate" href="http://localhost:8080/geoserver/rest/layers/WK1:mylayer.xml" type="application/xml"/></layer>
<layer><name>mylayer</name><atom:link rel="alternate" href="http://localhost:8080/geoserver/rest/layers/WK2:mylayer.xml" type="application/xml"/></layer>

The GeoServer relationship between workspace, stores, and layers (featureType resource in REST API) confuses me a bit.

If you just want to access the second layer, try using the workspace qualifier:

http://localhost:8080/geoserver/rest/layers/WK1:mylayer

(I'm using GeoServer 2.5.1)

This is similar to the questions:

  • Given a layer, what is its workspace?
  • How do I find all layers in a workspace?

Best...

1
  • You're right, the command with the workspace qualifier works. Thanks.
    – jeb
    Jul 4, 2014 at 19:28

Your Answer

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

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