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.6jeb– jeb2014年07月03日 20:51:48 +00:00Commented Jul 3, 2014 at 20:51
1 Answer 1
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– jeb2014年07月04日 19:28:14 +00:00Commented Jul 4, 2014 at 19:28