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?

mgri
16.4k6 gold badges48 silver badges80 bronze badges
asked Jul 3, 2014 at 14:37
1
  • I'm using Geoserver 2.4.4, but haven't seen any differences in the REST API documentation in version 2.6 Commented 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...

answered Jul 4, 2014 at 9:44
1
  • You're right, the command with the workspace qualifier works. Thanks. Commented Jul 4, 2014 at 19:28

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.