[Geoserver-users] Need to create a WFS request with multiple Layers: How to code that?

Hi,

I have multiple databases with the same tables and need to create a WFS request to get data from all databases.

My featuretypes are created exactly the same with a separate namespace. For example Namespace1:Table1 and Namespace2:Table1

In WMS I can declare a basemapgroup so that I only need 1 request from my client to get all data.

I want to create a similar concept in the WFS part of geoserver (because I don’t want to get all data by firing 60 wfs requests from my client.

Can somebody tell me if something similar exists or how to start coding this in geoserver.

cheers

Kris Geusebroek

Consultant



cid:image001.jpg@anonymised.com



Email: kgeusebroek@anonymised.com



Tel: +31 (0)35 538 1921



Fax: +31 (0)35 538 1922



Mobile: +31 (0)6 30 697 223



http://www.xebia.com







Utrechtseweg 49



1213 TL Hilversum



The Netherlands

Xebia Blog ! http://blog.xebia.com/

Xebia Podcast! http://podcast.xebia.com/

Kris Geusebroek ha scritto:

Hi,

I have multiple databases with the same tables and need to create a WFS request to get data from all databases.

My featuretypes are created exactly the same with a separate namespace. For example Namespace1:Table1 and Namespace2:Table1

In WMS I can declare a basemapgroup so that I only need 1 request from my client to get all data.

I want to create a similar concept in the WFS part of geoserver (because I don’t want to get all data by firing 60 wfs requests from my client.

Can somebody tell me if something similar exists or how to start coding this in geoserver.

WFS standard does not have, and does not allow for, layer groups.
But you can list multiple layers in a request and get back a composite
feature collection.
For example (live request, you can try it out):

http://geo.openplans.org:8080/geoserver/wfs?request=GetFeature&version=1.0.0&typeName=topp:tasmania_cities,topp:tasmania_water_bodies,topp:tasmania_roads

I also suggested in a previous mail you can use the database linking
abilities various database provide to build a single view out
of various database tables.

Introducing real layer group support _may_ be possible, but you'd
have to modify all the code that deals with describeFeatureType,
GetFeature, GetCapabilites, and we'd have to move the layer
group concept out of wms too. To make it right it would have to
be a huge patch :frowning:
Justin, what do you think? I guess DFT could return all the schemas
for all the types in the layer group, and GetFeature filters
could be replicated onto all ft as we do in GetFeature.
Basically, make WFS act a bit like WMS, where we do the
expansion from the single layer to the group inside the request
parsers, leaving the actual code oblivious the layer group even
exists. Makes for some clunky code in the KVP parser, and I'm
not sure how to fix the XML ones...

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Yes, this is an example of an overlay analysis of two layers

http://wfs.arealinfo.dk/wfs/GetFeature?SERVICE=WFS&VERSION=1.1.1&REQUEST=GetFeature&typename=kms:FYN_420_40019,kms:FYN_420_40020&filter=%3Cogc:Filter%3E%3CWithin%3E%3CPropertyName%3EWKB_GEOM%3C/PropertyName%3E%3Cgml:Polygon%3E%3Cgml:outerBoundaryIs%3E%3Cgml:LinearRing%3E%3Cgml:posList%3E549496.13738318,6154641.66028037%20549539.24953271,6154666.68224299%20549643.1588785,6154696.88084112%20549496.13738318,6154641.66028037%3C/gml:posList%3E%3C/gml:LinearRing%3E%3C/gml:outerBoundaryIs%3E%3C/gml:Polygon%3E%3C/Within%3E%3C/ogc:Filter%3E

On Fri, Apr 3, 2009 at 4:20 PM, Kris Geusebroek <kgeusebroek@anonymised.com> wrote:

Hi,

I have multiple databases with the same tables and need to create a WFS request to get data from all databases.

My featuretypes are created exactly the same with a separate namespace. For example Namespace1:Table1 and Namespace2:Table1

In WMS I can declare a basemapgroup so that I only need 1 request from my client to get all data.

I want to create a similar concept in the WFS part of geoserver (because I don’t want to get all data by firing 60 wfs requests from my client.

Can somebody tell me if something similar exists or how to start coding this in geoserver.

cheers

Kris Geusebroek

Consultant



cid:image001.jpg@anonymised.com



Email: kgeusebroek@anonymised.com



Tel: +31 (0)35 538 1921



Fax: +31 (0)35 538 1922



Mobile: +31 (0)6 30 697 223



http://www.xebia.com







Utrechtseweg 49



1213 TL Hilversum



The Netherlands

Xebia Blog ! http://blog.xebia.com/

Xebia Podcast! http://podcast.xebia.com/



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


Best regards,

Sune Edmund Pedersen
Head of GIS & IT, Vietnam


Grontmij | Carl Bro Vietnam
Number 23, Lane 183, Dang Tien Dong Street
Dong Da District, Hanoi
Vietnam

M + 84 9 0479 2908
T +84 4 3537 4860
Phone via Skype +45 6574 1771

E sune.edmund.pedersen@anonymised.com

Hi,

I was not aware that multiple typeNames in a wfs request was possible
(and yes Andrea, next week I'm going to try the db linking to see how
that performes)
The reason I was not aware is that I use the post version and tried to
do a <wfs:Query typeName="Namespace1:Table1,Namespace2:Table1"
xmlns:Namesapce1= etc. etc....
This gives an error from geoserver: could not locate {http://path to
namespace}Table1, Namespace2:Table1

But trying it with 2 separate wfs:Query segments in the request gave a
wonderfull result.

Now I only have to figure out how the WFS protocol of OpenLayers needs
to be changed to create such a request :wink:

Thanks for this help

Cheers Kris

-----Original Message-----
From: Andrea Aime [mailto:aaime@anonymised.com]
Sent: Friday, April 03, 2009 11:32 AM
To: Kris Geusebroek
Cc: geoserver-users@lists.sourceforge.net; Justin Deoliveira
Subject: Re: [Geoserver-users] Need to create a WFS request with
multiple Layers: How to code that?

Kris Geusebroek ha scritto:

Hi,

I have multiple databases with the same tables and need to create a

WFS

request to get data from all databases.

My featuretypes are created exactly the same with a separate

namespace.

For example Namespace1:Table1 and Namespace2:Table1

In WMS I can declare a basemapgroup so that I only need 1 request from

my client to get all data.

I want to create a similar concept in the WFS part of geoserver

(because

I don't want to get all data by firing 60 wfs requests from my client.

Can somebody tell me if something similar exists or how to start

coding

this in geoserver.

WFS standard does not have, and does not allow for, layer groups.
But you can list multiple layers in a request and get back a composite
feature collection.
For example (live request, you can try it out):

http://geo.openplans.org:8080/geoserver/wfs?request=GetFeature&version=1
.0.0&typeName=topp:tasmania_cities,topp:tasmania_water_bodies,topp:tasma
nia_roads

I also suggested in a previous mail you can use the database linking
abilities various database provide to build a single view out
of various database tables.

Introducing real layer group support _may_ be possible, but you'd
have to modify all the code that deals with describeFeatureType,
GetFeature, GetCapabilites, and we'd have to move the layer
group concept out of wms too. To make it right it would have to
be a huge patch :frowning:
Justin, what do you think? I guess DFT could return all the schemas
for all the types in the layer group, and GetFeature filters
could be replicated onto all ft as we do in GetFeature.
Basically, make WFS act a bit like WMS, where we do the
expansion from the single layer to the group inside the request
parsers, leaving the actual code oblivious the layer group even
exists. Makes for some clunky code in the KVP parser, and I'm
not sure how to fix the XML ones...

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.