[mapserver-users] MapServer crash with WFS GetFeature request using multiple typenames

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Mon Dec 5 05:16:01 EST 2011


Hi,

First, I have been thinking that there is perhaps not so often special advantage in using Contains. It will find features which are containing the whole reference geometry and that makes sense if point is used as the reference and features to find are polygons. With lines and polygons as reference the result is perhaps not the desired one, because intersecting features are not selected. It depends on the use case.

I believe the next Contains example is valid. You can test it yourself by doing copy-paste and sending it with Poster towards http://188.64.1.61/cgi-bin/tinyows

<wfs:GetFeature xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" maxFeatures="1000" outputFormat="text/xml; subtype=gml/3.1.1"><wfs:Query xmlns:lv="http://latuviitta.fi/" srsName="urn:ogc:def:crs:EPSG::3067" typeName="lv:pks_pienalue"><wfs:PropertyName>lv:name</wfs:PropertyName><wfs:PropertyName>lv:ogc_fid</wfs:PropertyName><wfs:PropertyName>lv:the_geom</wfs:PropertyName><ogc:Filter><ogc:Contains><ogc:PropertyName>lv:the_geom</ogc:PropertyName><gml:Point srsName="urn:ogc:def:crs:EPSG::3067">
<gml:pos srsDimension="2">385338.63323124044 6680121.5237366</gml:pos>
</gml:Point></ogc:Contains></ogc:Filter></wfs:Query></wfs:GetFeature>

Changing Contains to Intersects gives the same result. I do not have Mapserver WFS at the moment to test with.

-Jukka Rahkonen-

Dejan Gambin wrote:

> Hi Jukka
> 
> Accroding to your suggestions, I am trying to use 
> ogc:Contains instead of ogc:BBOX in my OL request, but it 
> fails with "Invalid or Unsupported FILTER in GetFeature" 
> error. So, using something like this:
> 
>         protocol: OpenLayers.Protocol.WFS({
>             version: "1.1.0",
>             url:  "http://www.coin.hr/cgi-bin/mywfs6?SERVICE=WFS",
>             srsName:"EPSG:900913",
>             //featureNS: "http://www.openplans.org/topp",
>             featureNS: "http://www.coin.hr",
>             geometryName: "msGeometry",
>             featurePrefix: "ms"
>         }),
>                 box: false,
>                 hover: false,
>                 //multipleKey: "shiftKey",
>                 toggleKey: "ctrlKey",
>         single: false,
> 
> generates the following mapserver SUCCESSFUL request:
> 
> <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" 
> service="WFS" version="1.1.0" 
> xsi:schemaLocation="http://www.opengis.net/wfs 
> http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><wfs:Que
> ry typeName="ms:katastar_vodnjan_poligon" 
> srsName="EPSG:900913" 
> xmlns:ms="http://www.coin.hr"><ogc:Filter 
> xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:Property
> Name>msGeometry</ogc:PropertyName><gml:Envelope 
> xmlns:gml="http://www.opengis.net/gml" 
> srsName="EPSG:900913"><gml:lowerCorner>1534339.5955039 
> 5613892.0444208</gml:lowerCorner><gml:upperCorner>1534345.5671
> 467 
> 5613898.0160636</gml:upperCorner></gml:Envelope></ogc:BBOX></o
> gc:Filter></wfs:Query></wfs:GetFeature>
> 
> Using the same OL request but with "filterType: 
> OpenLayers.Filter.Spatial.CONTAINS,", I get the following:
> 
> <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" 
> service="WFS" version="1.1.0" 
> xsi:schemaLocation="http://www.opengis.net/wfs 
> http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><wfs:Que
> ry typeName="ms:katastar_vodnjan_poligon" 
> srsName="EPSG:900913" 
> xmlns:ms="http://www.coin.hr"><ogc:Filter 
> xmlns:ogc="http://www.opengis.net/ogc"><ogc:Contains><ogc:Prop
> ertyName>msGeometry</ogc:PropertyName><gml:Envelope 
> xmlns:gml="http://www.opengis.net/gml" 
> srsName="EPSG:900913"><gml:lowerCorner>1534345.2685645 
> 5613850.242921</gml:lowerCorner><gml:upperCorner>1534348.25438
> 6 
> 5613853.2287424</gml:upperCorner></gml:Envelope></ogc:Contains
> ></ogc:Filter></wfs:Query></wfs:GetFeature>
> 
> and this is giving me the above error
> 
> Obviously I am doing something wrong :-)
> 
> Any help? I have MapServer 6.0.1, built from source
> 
> dejan
> 
> On 14. stu. 2011., at 14:51, Rahkonen Jukka wrote:
> 
> > Hi,
> > 
> > Feel free to test with my TinyOWS server at 
> http://188.64.1.61/cgi-bin/tinyows. I would not encourage you 
> to use BBOX filter for finding features.  According to the 
> standard BBOX is a synonyme for Intersects but for example 
> Geoserver is using it in a bit different way. It is comparing 
> if feature bounding boxes are intersecting with reference 
> bounding box if BBOX is used. This suits perfectly for 
> filling a screen with features because feature bounding boxes 
> can be found fast from the spatial index of a database. 
> However, with lines and polygons this search is sometimes 
> finding extra features. Intersects is doing a real comparison 
> of geometries which is accurate but slower.  If you click on 
> a map why don't you use ogc:Contains for finding polygons or 
> ogc;DWithin filter for finding all kind of features with a buffer?
> > 
> > My TinyOWS has a bug with ogc:BBOX so if you test it, use 
> Intersects, Contains, or DWithin instead.
> > 
> > Naturally WFS should behave in a similar way independently 
> of the data source behind the server. 
> > 
> > -Jukka Rahkonen-
> > 
> >> -----Alkuperäinen viesti-----
> >> Lähettäjä: Dejan Gambin [mailto:dejan.gambin at coin.hr] 
> >> Lähetetty: 14. marraskuuta 2011 15:33
> >> Vastaanottaja: Rahkonen Jukka
> >> Kopio: 'mapserver-users at lists.osgeo.org'
> >> Aihe: Re: [mapserver-users] MapServer crash with WFS 
> >> GetFeature request using multiple typenames
> >> 
> >> Hello Jukka
> >> 
> >> Thanks for the information. I am trying to make a spatial 
> >> search by clicking on the point on the map. This search 
> >> should send the requests for every active layer and return 
> >> the results for some bbox around this point. I have first 
> >> tried with WMS GetFeatureInfo but also stucked with gml not 
> >> being recognized by OpenLayers. So I decided to try with WFS. 
> >> It works OK when data is in PostGIS and also works for one 
> >> shape file but not for all I need.
> >> 
> >> Of course, it can be done by sending multiple requests, one 
> >> for each active layer, but I thought this should work for 
> >> several layers too.
> >> 
> >> 
> >> On 14. stu. 2011., at 14:20, Rahkonen Jukka wrote:
> >> 
> >>> Hi,
> >>> 
> >>> It is not so very common to make GetFeature requests for a 
> >> list of FeatureTypes, especially with filters. Therefore 
> >> servers are for sure not well tested with such requests. Do 
> >> you have some special need for getting just one GML package 
> >> out or WFS or can you imagine to do one request per feature type?
> >>> 
> >>> By the way, are you aware of that if you query typeNames 
> >> "A" and "B" with maxfeatures=10, the resultset will be cut at 
> >> the 10th feature. If the server finds 10 or more candidates 
> >> from typeName "A" you will not get any features at all from 
> >> typeName "B".
> >>> 
> >>> -Jukka Rahkonen-
> >>> 
> >>> Dejan Gambin wrote:
> >>> 
> >>> 
> >>>> 
> >>>> Anyway, seems like this ogrinfo error has nothing to do with 
> >>>> mapserver crash. So the problem persists :-(
> >>>> 
> >>>> dejan
> >>>> On 14. stu. 2011., at 11:49, Dejan Gambin wrote:
> >>>> 
> >>>>> Additional info:
> >>>>> 
> >>>>> Everything works OK when data is in postgis. The problem is 
> >>>> with data coming from shape file on which ogrinfo reports the 
> >>>> following:
> >>>>> 
> >>>>> dgambin at coin:/$ ogrinfo -so 
> >>>> sportsko_rekreacijska_namjena.shp sportsko_rekreacijska_namjena
> >>>>> ERROR 4: Unable to open sportsko_rekreacijska_namjena.shp 
> >>>> or sportsko_rekreacijska_namjena.SHP.
> >>>>> Had to open data source read-only.
> >>>>> INFO: Open of `sportsko_rekreacijska_namjena.shp'
> >>>>>    using driver `ESRI Shapefile' successful.
> >>>>> 
> >>>>> Layer name: sportsko_rekreacijska_namjena
> >>>>> Geometry: Polygon
> >>>>> Feature Count: 12
> >>>>> Extent: (5401303.525844, 4978030.196207) - (5407353.143421, 
> >>>> 4986100.367492)
> >>>>> Layer SRS WKT:
> >>>>> (unknown)
> >>>>> ID: Integer (8.0)
> >>>>> NAMJENA: String (30.0)
> >>>>> POVRSINA: Real (16.2)
> >>>>> OZNAKA: String (100.0)
> >>>>> 
> >>>>> 
> >>>>> 
> >>>>> On 14. stu. 2011., at 10:35, Dejan Gambin wrote:
> >>>>> 
> >>>>>> Hi,
> >>>>>> 
> >>>>>> I have a serious issue usng MapServer WFS in making 
> >>>> GetFeature request using multiple typenames. Here is the 
> >>>> example post request:
> >>>>>> 
> >>>>>> [Mon Nov 14 09:16:06 2011].666863 msWFSParseRequest(): WFS 
> >>>> post request: <wfs:GetFeature 
> >>>> xmlns:wfs="http://www.opengis.net/wfs" service="WFS" 
> >>>> version="1.1.0" maxFeatures="10" 
> >>>> xsi:schemaLocation="http://www.opengis.net/wfs 
> >>>> http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" 
> >>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><wfs:Que
> >>>> ry typeName="ms:ppu_sportska" srsName="EPSG:900913" 
> >>>> xmlns:ms="http://www.openplans.org/topp"><ogc:Filter 
> >>>> xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:Property
> >>>> Name>msGeometry</ogc:PropertyName><gml:Envelope 
> >>>> xmlns:gml="http://www.opengis.net/gml" 
> >>>> srsName="EPSG:900913"><gml:lowerCorner>1533843.3519844 
> >>>> 5619282.0492426</gml:lowerCorner><gml:upperCorner>1533938.8982
> >>>> 697 
> >>>> 5619377.595528</gml:upperCorner></gml:Envelope></ogc:BBOX></og
> >>>> c:Filter></wfs:Query><wfs:Query typeName="ms:ppu_turisticka" 
> >>>> srsName="EPSG:900913" 
> >>>> xmlns:ms="http://www.openplans.org/topp"><ogc:Filter 
> >>>> xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:Property
> >>>> Name>msGeometry</ogc:PropertyName><gml:Envelope 
> >>>> xmlns:gml="http://www.opengis.net/gml" 
> >>>> srsName="EPSG:900913"><gml:lowerCorner>1533843.3519844 
> >>>> 5619282.0492426</gml:lowerCorner><gml:upperCorner>1533938.8982
> >>>> 697 
> >>>> 5619377.595528</gml:upperCorner></gml:Envelope></ogc:BBOX></og
> >>>> c:Filter></wfs:Query></wfs:GetFeature>
> >>>>>> [Mon Nov 14 09:16:06 2011].683317 msQueryByFilter(): 
> >>>> Search returned no results. No matching record(s) found.
> >>>>>> 
> >>>>>> It is using 2 typenames: "ms:ppu_sportska" and 
> >>>> "ms:ppu_turisticka". Seems like no results were found but 
> >>>> there are bunch of errors in apache log file, like:
> >>>>>> 
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> *** glibc detected *** /usr/lib/cgi-bin/mapserv61: double 
> >>>> free or corruption (out): 0x0000000001a83d60 ***, referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> ======= Backtrace: =========, referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /lib/libc.so.6(+0x71ad6)[0x7f58d7c43ad6], referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /lib/libc.so.6(cfree+0x6c)[0x7f58d7c4884c], referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /usr/lib/cgi-bin/mapserv61[0x4328c6], referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /usr/lib/cgi-bin/mapserv61[0x438719], referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /usr/lib/cgi-bin/mapserv61[0x455d2d], referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /usr/lib/cgi-bin/mapserv61[0x455b8c], referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /usr/lib/cgi-bin/mapserv61[0x4df5c4], referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /usr/lib/cgi-bin/mapserv61[0x4bf415], referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /usr/lib/cgi-bin/mapserv61(msLayerApplyPlainFilterToLayer+0x23
> >>> )[0x47a99c], referer: http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /usr/lib/cgi-bin/mapserv61[0x4bf362], referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /usr/lib/cgi-bin/mapserv61[0x49ffe0], referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /usr/lib/cgi-bin/mapserv61[0x4a1c8e], referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /usr/lib/cgi-bin/mapserv61[0x495f17], referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /usr/lib/cgi-bin/mapserv61[0x4182b7], referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /lib/libc.so.6(__libc_start_main+0xfd)[0x7f58d7bf0c4d], 
> >>>> referer: http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /usr/lib/cgi-bin/mapserv61[0x413609], referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> ======= Memory map: ========, referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> ...bunch of library references
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> 7f58db7ca000-7f58db7cb000 r--p 0001d000 ca:01 1855039         
> >>>>          /lib/ld-2.11.2.so, referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> 7f58db7cb000-7f58db7cc000 rw-p 0001e000 ca:01 1855039         
> >>>>          /lib/ld-2.11.2.so, referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> 7f58db7cc000-7f58db7cd000 rw-p 00000000 00:00 0 , referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> 7fff70721000-7fff70736000 rw-p 00000000 00:00 0               
> >>>>          [stack], referer: http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> 7fff70777000-7fff70778000 r-xp 00000000 00:00 0               
> >>>>          [vdso], referer: http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0       
> >>>>          [vsyscall], referer: 
> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> /usr/lib/cgi-bin/mywfs6: line 4:  3294 Aborted                
> >>>> /usr/lib/cgi-bin/mapserv61, referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> [Mon Nov 14 09:16:06 2011] [error] [client 83.131.213.54] 
> >>>> Premature end of script headers: mywfs6, referer: 
> >>>> http://www.coin.hr/coingis/demo.html
> >>>>>> 
> >>>>>> Sometimes the error was starting with:
> >>>>>> 
> >>>>>> [Mon Nov 14 08:25:06 2011] [error] [client 83.131.213.54] 
> >>>> *** glibc detected *** /usr/lib/cgi-bin/mapserv61: 
> >>>> munmap_chunk(): invalid pointer: 0x000000000273ca80 ***, 
> >>>> referer: http://www.coin.hr/coingis/demo.html
> >>>>>> 
> >>>>>> NOTE: Making individual requests to those typenames works OK
> >>>>>> 
> >>>>>> I would appreciate any help since I am pretty stucked with 
> >>>> this. Should I report it as a bug?
> >>>>>> 
> >>>>>> Thanks very much
> >>>>>> 
> >>>>>> regards, dejan
> >>>>>> 
> >>>>>> 
> >>>>>> _______________________________________________
> >>>>>> 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