Hi Anton,

I really appreciate the response. I now have layerGroups copying to the new 
workspaces nicely.


I retrieve all coverageStores, coverages, dataStores, featureTypes, and 
layerGroups from a workspace, modify the name and hrefs where necessary, then 
post back to the newly created workspace's endpoints.

Everything works well, except the styles - for some reason the styles aren't 
copied over to the cloned layers. Have you had any success with layer styles?


Thanks and regards,

Kris

________________________________
From: Anton Bakker <[email protected]>
Sent: Thursday, 1 February 2018 3:03:49 AM
To: Kris Powell
Cc: [email protected]
Subject: Re: [Geoserver-users] Problem with creating LayerGroup using REST api

Hi Kris,

For me the following request body works to create a new layergroup (on 
GeoServer 2.12, but should work for other versions as well):

<layerGroup>
  <name>group_c</name>
  <mode>CONTAINER</mode>
  <title>group_c</title>
  <abstractTxt></abstractTxt>
  <workspace>
    <name>charts</name>
  </workspace>
  <publishables>
    <published type="layer">
      <name>charts:world_cities</name>
      <atom:link xmlns:atom=“http://www.w3.org/2005/Atom” rel=“alternate" 
href="http://<host>/geoserver/rest/layers/charts:world_cities.xml" 
type="application/xml" />
    </published>
    <published type="layer">
      <name>charts:usa_states</name>
      <atom:link xmlns:atom="http://www.w3.org/2005/Atom"; rel="alternate" 
href="http://<host>/geoserver/rest/layers/charts:usa_states.xml" 
type="application/xml" />
    </published>
  </publishables>
  <styles>
    <style />
    <style />
  </styles>
  <bounds>
    <minx>-124.731422</minx>
    <maxx>151.206955</maxx>
    <miny>-37.817532</miny>
    <maxy>59.916269143887</maxy>
    <crs class="projected">EPSG:4326</crs>
  </bounds>
</layerGroup>

So the published/name element should use the following format 
<workspace>:<layername>, the same is true for the url of that layer.  Hope this 
helps!

Kind regards,
Anton Bakker
GeoCat BV


On 25 Jan 2018, at 02:34, Kris Powell 
<[email protected]<mailto:[email protected]>> wrote:

Hi Tam,


Did you ever find out more about this issue?

I've been building a tool to clone existing workspaces including stores,
layers and layergroups, and I'm running into the same problem you mention
here. The response I receive from geoserver is:

`Layer group within a workspace (testworkspace) can not contain resources
from other workspace: existingworkspace`

when I POST a new layerGroup to
`.../rest/workspaces/testworkspace/layergroups`


Any light you or other subscribers could shed on this would be very helpful.

Regards,
Kris



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org<http://Slashdot.org>! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/geoserver-users

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to