[Geoserver-users] nested layergroup throug rest api on v2.3

Hi List,

Being new to using the REST API I would like to ask you how to create a nested layergroup through the REST API?

My curl is:

curl -v -u user:pwd -XPOST -H ‘Content-type: text/xml’ -d “20132013CONTAINER201304” http://localhost:8080/geoserver/rest/workspaces/myworkspace/layergroups

Where “2013” is the new layerGroup and “201304” is an existing layerGroup.

I could successfully create a layerGroup consisting of plain layers.

Thanks for your views on this,
Csaba


Sándor Csaba
szolgáltatási vezető
ViaMap Kft.
Székhely/postacím: 2176 Erdőkürt, Téglaház utca 4.

Iroda:
1076 Budapest, Garay u. 29-31. I. 1.
(EMLA Környezeti Management és Jog Egyesület)

Tel: +3630/9605853
Fax: +3617002542

On Mon, Apr 22, 2013 at 4:44 PM, Sandor Csaba <sandor.csaba@anonymised.com>wrote:

Hi List,

Being new to using the REST API I would like to ask you how to create a
nested layergroup through the REST API?

My curl is:
curl -v -u user:pwd -XPOST -H 'Content-type: text/xml' -d
"<layerGroup><name>2013</name><title>2013</title><mode>CONTAINER</mode><layers><layer>201304</layer></layers></layerGroup>"
http://localhost:8080/geoserver/rest/workspaces/myworkspace/layergroups

Where "2013" is the new layerGroup and "201304" is an existing layerGroup.

I could successfully create a layerGroup consisting of plain layers.

The general advice when you are looking at some REST construct that lacks
documentation is
simple, and always the same:
- configure what you need in the GUI
- use GET requests to gather the resources you modified and look at their
structure
- repeat it with your REST api calls

Cheers
Andrea

--

GeoServer training in Milan, 6th & 7th June 2013! Visit
http://geoserver.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Thanks for the hint!

The curl that actually did the job:

curl -v -u user:pwd -XPOST -H ‘Content-type: text/xml’ -d “2008CONTAINER2008icecapicecap:200801-40000004000000-40000004000000EPSG:3411” http://localhost:8080/geoserver/rest/layergroups

Strange enough (for me) that this is completely different from the “normal” not-nested-layergroup creation.

Thanks again,
Csaba

···

On 23 April 2013 09:07, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Mon, Apr 22, 2013 at 4:44 PM, Sandor Csaba <sandor.csaba@anonymised.com> wrote:


Try New Relic Now & We’ll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users


Sándor Csaba
szolgáltatási vezető
ViaMap Kft.
Székhely/postacím: 2176 Erdőkürt, Téglaház utca 4.

Iroda:
1076 Budapest, Garay u. 29-31. I. 1.
(EMLA Környezeti Management és Jog Egyesület)

Tel: +3630/9605853
Fax: +3617002542

Hi List,

Being new to using the REST API I would like to ask you how to create a nested layergroup through the REST API?

My curl is:

curl -v -u user:pwd -XPOST -H ‘Content-type: text/xml’ -d “20132013CONTAINER201304” http://localhost:8080/geoserver/rest/workspaces/myworkspace/layergroups

Where “2013” is the new layerGroup and “201304” is an existing layerGroup.

I could successfully create a layerGroup consisting of plain layers.

The general advice when you are looking at some REST construct that lacks documentation is
simple, and always the same:

  • configure what you need in the GUI
  • use GET requests to gather the resources you modified and look at their structure
  • repeat it with your REST api calls

Cheers
Andrea

==
GeoServer training in Milan, 6th & 7th June 2013! Visit http://geoserver.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On Tue, Apr 23, 2013 at 3:06 PM, Sandor Csaba <sandor.csaba@anonymised.com>wrote:

Thanks for the hint!

The curl that actually did the job:

curl -v -u user:pwd -XPOST -H 'Content-type: text/xml' -d
"<layerGroup><name>2008</name><mode>CONTAINER</mode><title>2008</title><workspace><name>icecap</name></workspace><publishables><published
type='layerGroup'><name>icecap:200801</name></published></publishables><bounds><minx>-4000000</minx><maxx>4000000</maxx><miny>-4000000</miny><maxy>4000000</maxy><crs
class='projected'>EPSG:3411</crs></bounds></layerGroup>"
http://localhost:8080/geoserver/rest/layergroups

Strange enough (for me) that this is completely different from the
"normal" not-nested-layergroup creation.

Yes, the data structures had to be changed completely in order
to accommodate the mix of normal layers and layer groups

Cheers
Andrea

--

GeoServer training in Milan, 6th & 7th June 2013! Visit
http://geoserver.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Hi,

OK so far so good. Next one: how can I add a new layer to a group?

Do I have to resubmit the whole layergroup definition to the existing layergroup endpoint (http://localhost:8080/geoserver/rest/layergroups/myLayerGroup) with -XPUT?

(Actually tried this and resulted in an empty layergroup looking at it on the GUI)

Any hint on this?

Thanks,
Csaba

···

On 23 April 2013 15:07, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Tue, Apr 23, 2013 at 3:06 PM, Sandor Csaba <sandor.csaba@anonymised.com> wrote:


Try New Relic Now & We’ll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users


Sándor Csaba
szolgáltatási vezető
ViaMap Kft.
Székhely/postacím: 2176 Erdőkürt, Téglaház utca 4.

Iroda:
1076 Budapest, Garay u. 29-31. I. 1.
(EMLA Környezeti Management és Jog Egyesület)

Tel: +3630/9605853
Fax: +3617002542

Thanks for the hint!

The curl that actually did the job:

curl -v -u user:pwd -XPOST -H ‘Content-type: text/xml’ -d “2008CONTAINER2008icecapicecap:200801-40000004000000-40000004000000EPSG:3411” http://localhost:8080/geoserver/rest/layergroups

Strange enough (for me) that this is completely different from the “normal” not-nested-layergroup creation.

Yes, the data structures had to be changed completely in order to accommodate the mix of normal layers and layer groups

Cheers

Andrea

==
GeoServer training in Milan, 6th & 7th June 2013! Visit http://geoserver.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On Wed, Apr 24, 2013 at 9:55 PM, Sandor Csaba <sandor.csaba@anonymised.com>wrote:

Hi,

OK so far so good. Next one: how can I add a new layer to a group?

Do I have to resubmit the whole layergroup definition to the existing
layergroup endpoint (http://localhost:8080/geoserver/rest/layergroups/myLayerGroup)
with -XPUT?

Yes, that's the way

(Actually tried this and resulted in an empty layergroup looking at it on
the GUI)

Hmm... not sure why. If you can reproduce it with the sample data
directory, please open a bug report at jira.codehaus.org
(register at xircles.codehaus.org if you don't have an account), and
provide the exact call you're making

Cheers
Andrea

--

GeoServer training in Milan, 6th & 7th June 2013! Visit
http://geoserver.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------