[mapserver-users] WFS GetFeature with filter for multiple layers

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Wed Jan 23 04:17:46 PST 2013


Hi,

I found this example from archives http://www.mail-archive.com/mapserver-users@lists.osgeo.org/msg10755.html
It has worked with two featuretypes and two filters on Mapserver.

-Jukka-


Arjen de Korte wrote:
> 
> Thanks for your time and suggestions!
> 
> - I'll have a good look at the filter again.
> - I understand this. Even if I would want to, it doesn't work with Mapserver,
> which is what brought me here. (Since we have the server under control
> also, the complications you mention would be less of an issue, but in principle
> I agree!)
> - How do I correctly specify a list of filters? (This is my original
> question.) If I get this to work, the problem is solved. I'm not in the position
> to change/upgrade my client's Mapserver.
> - I agree this is better/simpler in a lot of regards, but this will be for the long
> term. I will however make the WFS requests using POST as I already have
> problems with urls that become too long.
> 
> Kind regards,
> Arjen.
> 
> 
> On Wed, Jan 23, 2013, at 12:03, Rahkonen Jukka wrote:
> > Hi,
> >
> > Some thoughts:
> >
> > - I am not a specialist with filters, but are you sure that your
> > filter is correct?  I have some examples about filters in page
> > http://latuviitta.org/Http-POST-ja-Filter.php but they are generated
> > by a ready made application (Kosmo GIS).
> > - One filter for many layers is not the way to go. For example, it can
> > only work if all the feature types are using same name for the
> > geometry field, and filtering with attributes would also require
> > similar attribute schemas. You may get it to work with your own server
> > but your application won't most probably work against any other WFS
> server.
> > - Correct way is to use a list of filters. If your old Mapserver does
> > not support it correctly, update of change to some other server that
> > supports.
> > - Continue to consider doing one request per one feature type, for
> > many reasons.  It will be a hell to find out what goes wrong with
> > multi-featuretype and multi-filter requests and if one thing fails
> > then nothing works. I am sure that all WFS servers are poorly tested
> > with featuretype lists and lists of filters, especially if you are
> > going to use http GET.  Filters suit much better for http POST and
> > that is better tested option too.
> >
> > Feel free to test with my TinyOWS at
> > http://hip.latuviitta.org/cgi-bin/tinyows? It would be nice to see
> > what goes to my access and error logs.
> >
> > -Jukka Rahkonen-
> >
> >
> > > -----Alkuperäinen viesti-----
> > > Lähettäjä: Arjen de Korte [mailto:arjendk at gmx.net]
> > > Lähetetty: 23. tammikuuta 2013 12:09
> > > Vastaanottaja: Rahkonen Jukka; Lime, Steve D (DNR); mapserver-
> > > users at lists.osgeo.org
> > > Aihe: Re: [mapserver-users] WFS GetFeature with filter for multiple
> > > layers
> > >
> > > Hi Jukka,
> > >
> > > Thanks for the suggestion. I am already taking that into
> > > consideration (and probably should have mentioned it). The problem
> > > is that it would be quite some work to get it into the existing
> > > application that way. For simplicity I gave an example with two
> > > layers, but there can actually be many more, depending on the map
> > > that is displayed. I would definitely like to keep it simple, but in
> > > this case one GetFeature request would definitely be a simpler solution!
> Any other suggestions welcome!
> > >
> > > Thanks!
> > >
> > > Kind regards,
> > > Arjen.
> > >
> > >
> > > On Wed, Jan 23, 2013, at 10:39, Rahkonen Jukka wrote:
> > > > Hi,
> > > >
> > > > Keep it simple and make two separate GetFeatures, one for each
> > > > feature type.
> > > >
> > > > -Jukka Rahkonen-
> > > >
> > > > Arjen de Korte wrote:
> > > >
> > > >
> > > > > Hi Steve,
> > > > >
> > > > > Yes, for now I (my client) is stuck to this version, so a
> > > > > workaround (or accepting that it can't be done) is the only
> > > > > option at the moment. Has this been solved in newer versions?
> > > > >
> > > > > Kind regards,
> > > > > Arjen.
> > > > >
> > > > >
> > > > > On Tue, Jan 22, 2013, at 20:15, Lime, Steve D (DNR) wrote:
> > > > > > Are you stuck running such an old version?
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: mapserver-users-bounces at lists.osgeo.org
> > > > > > [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of
> > > > > > Arjen de Korte
> > > > > > Sent: Tuesday, January 22, 2013 10:45 AM
> > > > > > To: mapserver-users at lists.osgeo.org
> > > > > > Subject: [mapserver-users] WFS GetFeature with filter for
> > > > > > multiple layers
> > > > > >
> > > > > > Hi all,
> > > > > >
> > > > > > I'm having a problem with Mapserver 5.2.1 and WFS GetFeature
> > > requests:
> > > > > > when I do a GetFeature request with an OGC filter for more
> > > > > > than one layer, I only get results for the first layer. I
> > > > > > found a description of the issue here:
> > > https://github.com/mapserver/mapserver/issues/3584.
> > > > > > It says the issue can be worked around by listing a separate
> > > > > > filter for each layer, but I can't work out a way to do this.
> > > > > >
> > > > > > My original request looks like this:
> > > > > >
> > > > > > http://myserver.com/cgi-
> > > > > bin/mapserv.exe?map=mymapfile.map&Service=WFS&
> > > > > >
> > > > >
> > >
> Request=GetFeature&TypeName=layer1,layer2&Version=1.0.0&Filter=<ogc:
> > > > > Fi
> > > > > > lter
> > > > > >
> > > > >
> > >
> xmlns:ogc="http://www.opengis.net/ogc"><ogc:Intersects><ogc:Property
> > > > > N
> > > > > a
> > > > > > me/><gml:Polygon
> > > > > >
> > > > >
> > >
> xmlns:gml="http://www.opengis.net/gml"><gml:outerBoundaryIs><gml:Lin
> > > > > ea
> > > > > > rRing><gml:coordinates decimal="." cs="," ts="
> > > > > > ">89760.045356755,436071.75388938
> > > > > > 89762.029730683,436071.75388938 89762.029730683,436073.7382633
> > > > > > 89760.045356755,436073.7382633
> > > > > >
> > > > >
> > >
> 89760.045356755,436071.75388938</gml:coordinates></gml:LinearRing></
> > > > > g
> > > > > m
> > > > > > l:outerBoundaryIs></gml:Polygon></ogc:Intersects></ogc:Filter>
> > > > > >
> > > > > > ...returning only results for layer1.
> > > > > >
> > > > > > I've tried repeating the exact same filter like:
> > > > > >
> > > > > > http://myserver.com/cgi-
> > > > > bin/mapserv.exe?map=mymapfile.map&Service=WFS&
> > > > > > Request=GetFeature&TypeName=layer1,
> > > > > > layer2&Version=1.0.0&Filter=<ogc:Filter
> > > > > > xmlns:ogc="http://www.opengis.net/ogc"><ogc:Intersects> ...
> > > > > > </ogc:Intersects><ogc:Intersects> ...
> > > > > > </ogc:Intersects></ogc:Filter>
> > > > > >
> > > > > > and
> > > > > >
> > > > > > http://myserver.com/cgi-
> > > > > bin/mapserv.exe?map=mymapfile.map&Service=WFS&
> > > > > > Request=GetFeature&TypeName=layer1,
> > > > > > layer2&Version=1.0.0&Filter=<ogc:Filter
> > > > > > xmlns:ogc="http://www.opengis.net/ogc"><ogc:Intersects> ...
> > > > > > </ogc:Intersects></ogc:Filter>,<ogc:Filter><ogc:Intersects> ...
> > > > > > </ogc:Intersects></ogc:Filter>
> > > > > >
> > > > > > ...but the first returns the same: only results for layer1,
> > > > > > and the second returns an error.
> > > > > >
> > > > > > What is the correct way to list multiple filters, or is there
> > > > > > another solution to work around this limitation?
> > > > > >
> > > > > > Thanks!
> > > > > >
> > > > > > Kind regards,
> > > > > > Arjen.
> > > > > > _______________________________________________
> > > > > > mapserver-users mailing list
> > > > > > mapserver-users at lists.osgeo.org
> > > > > > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> > > > > >
> > > > > >
> > > > > _______________________________________________
> > > > > mapserver-users mailing list
> > > > > mapserver-users at lists.osgeo.org
> > > > > http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the MapServer-users mailing list