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?

  • 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 '14 at 20:51
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...

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

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.