<html><head></head><body><div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px"><div id="yui_3_16_0_ym19_1_1493888588951_7188">Hi,</div><div id="yui_3_16_0_ym19_1_1493888588951_7186"><br></div><div id="yui_3_16_0_ym19_1_1493888588951_7184">Still no much progress on it, is there anyone who faced the similar problem and got the solution?</div><div id="yui_3_16_0_ym19_1_1493888588951_7307"><br></div><div id="yui_3_16_0_ym19_1_1493888588951_7308">Thanks.<br></div><div id="yui_3_16_0_ym19_1_1493888588951_7138"> </div><div class="signature" id="yui_3_16_0_ym19_1_1493888588951_7137"><font size="2">Regards,<br>Kajod<br></font></div><div class="qtdSeparateBR" id="yui_3_16_0_ym19_1_1493888588951_7069"><br><br></div><div class="yahoo_quoted" id="yui_3_16_0_ym19_1_1493888588951_7112" style="display: block;"> <div style="font-family: Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 13px;" id="yui_3_16_0_ym19_1_1493888588951_7111"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif; font-size: 16px;" id="yui_3_16_0_ym19_1_1493888588951_7110"> <div dir="ltr" id="yui_3_16_0_ym19_1_1493888588951_7109"> <font id="yui_3_16_0_ym19_1_1493888588951_7108" size="2" face="Arial"> <hr id="yui_3_16_0_ym19_1_1493888588951_7107" size="1"> <b><span style="font-weight:bold;">From:</span></b> Kajod Sharma <kajod4u@yahoo.com><br> <b><span style="font-weight: bold;">To:</span></b> Rahkonen Jukka (MML) <jukka.rahkonen@maanmittauslaitos.fi>; Jeff McKenna <jmckenna@gatewaygeomatics.com>; "mapserver-users@lists.osgeo.org" <mapserver-users@lists.osgeo.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, 27 April 2017 11:09 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [mapserver-users] Issue in using MapServer WFS Filter<br> </font> </div> <div class="y_msg_container" id="yui_3_16_0_ym19_1_1493888588951_7190"><br><div id="yiv6862950439"><div id="yui_3_16_0_ym19_1_1493888588951_7193"><div style="color:#000;background-color:#fff;font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px;" id="yui_3_16_0_ym19_1_1493888588951_7192">Thanks for valuable response.<div id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3106"><span><br clear="none"></span></div><div dir="ltr" id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3238"><span id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3277">I tried the solution suggested by you with putting NO for </span><span id="yui_3_16_0_ym19_1_1493888588951_7282">wfs_use_default_extent_for_getfeature. But still I can see default spatial filter in query.</span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1493888588951_7280"><span><br clear="none"></span></div><div dir="ltr" id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3316"><span id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3411">I even tried with passing BBOX (which I don't want) in filter, but it's taking the default one...it's wierd :(</span></div><div id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3143"><div id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3412"><br clear="none"></div><div dir="ltr" id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3413">I'll try to get SQL for sample data and will share if I can.</div><div dir="ltr" id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3441"><br clear="none"></div><div dir="ltr" id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3440">Thanks.<br clear="none"></div><div id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3419"><br clear="none"></div></div><div class="yiv6862950439signature" id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3148"><font size="2">Regards,<br clear="none">Kajod<br clear="none"></font></div><div class="yiv6862950439qtdSeparateBR" id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3200"><br clear="none"><br clear="none"></div><div class="yiv6862950439yqt9489998549" id="yiv6862950439yqt15536"><div class="yiv6862950439yahoo_quoted" id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3172" style="display:block;"> <div id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3171" style="font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px;"> <div id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3170" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif;font-size:16px;"> <div dir="ltr" id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3174"> <font id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3199" size="2" face="Arial"> </font><hr id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3420" size="1"> <b><span style="font-weight:bold;">From:</span></b> Rahkonen Jukka (MML) <jukka.rahkonen@maanmittauslaitos.fi><br clear="none"> <b><span style="font-weight:bold;">To:</span></b> Jeff McKenna <jmckenna@gatewaygeomatics.com>; "mapserver-users@lists.osgeo.org" <mapserver-users@lists.osgeo.org> <br clear="none"> <b><span style="font-weight:bold;">Sent:</span></b> Wednesday, 26 April 2017 8:57 PM<br clear="none"> <b><span style="font-weight:bold;">Subject:</span></b> Re: [mapserver-users] Issue in using MapServer WFS Filter<br clear="none"> </div> <div class="yiv6862950439y_msg_container" id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3169"><br clear="none"><div dir="ltr" id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3168">Hi,<br clear="none"><br clear="none">When it comes to extra spatial filter, there is a brand new metadata item for switching it off. See <a rel="nofollow" shape="rect" id="yiv6862950439yui_3_16_0_ym19_1_1493287513971_3442" target="_blank" href="http://mapserver.org/ogc/wfs_server.html">http://mapserver.org/ogc/wfs_server.html</a><br clear="none"><br clear="none"><br clear="none">wfs_use_default_extent_for_getfeature<br clear="none"> (Optional, since MapServer 7.0.4) Whether the MAP.EXTENT should be used in request to datasources in the absence of other spatial filter. This is the default behaviour, but this might affect performance in some use cases. In those cases, setting this item to NO will avoid he default spatial filter to be appended to the request. This is only implemented for OGR datasources. <br clear="none"><br clear="none">However, with PostGIS the && query is fast. The weird part in your log<br clear="none">wkb_geometry &&<br clear="none"> ST_GeomFromText('POLYGON((-0.999462804873474<br clear="none"> -1.00102606014116,-0.999462804873474<br clear="none"> -1.00102606014116,-0.999462804873474<br clear="none"> -1.00102606014116,-0.999462804873474<br clear="none"> -1.00102606014116,-0.999462804873474<br clear="none"> -1.00102606014116))<br clear="none"><br clear="none">means that the layer extent is not set correctly or Mapserver can't get is correctly from PostGIS which means data error on that side. For sure using the non-existing keyword wfs_boundingbox is not right. See what can be used from http://mapserver.org/ogc/wfs_server.html.<br clear="none"><br clear="none">When you play with spatial filters I recommend to start by using the native SRS for the feature type in filters. Non-native SRS in filter should be transformed by the server but it is error prone. Your filter is also also a little bit fuzzy. gml:coordinates belongs to GML2 and was removed from GML2. But you are using service version 2.0 that defaults to GML3. Is the meaning that your filter is GML2 or GML3? That is a big difference because in the first case the axis order of EPSG:4326 coordinates is longitude-latitude but in the latter it is latitude-longitude. Do you search near the equator or from somewhere in Europe?<br clear="none"><br clear="none"> <PropertyName>wkb_Geometry</PropertyName><br clear="none"> <gml:Point srsName="urn:ogc:def:crs:EPSG::4326"><br clear="none"> <gml:coordinates>0.112034,53.567972</gml:coordinates><br clear="none"> </gml:Point><br clear="none"><br clear="none">One more thing, "wfs_srs" metadata takes only one SRS, not a list.<br clear="none"><br clear="none">If you send SQL for CREATE TABLE and for inserting one polygon into the table, and WFS filter you are using in your trials I thing I could find some time for testing.<br clear="none"><br clear="none">-Jukka Rahkonen-<br clear="none">________________________________________<br clear="none">Jeff McKenna wrote:<br clear="none">Re: [mapserver-users] Issue in using MapServer WFS Filter<br clear="none"><br clear="none">Hi Kajod,<br clear="none"><br clear="none">If you are using PostGIS, then I would set the 'wfs_extent' metadata at<br clear="none">the layer level of the mapfile (it looks like you tried that, with an<br clear="none">odd 'wfs_boundingbox' parameter): please review the syntax of the<br clear="none">wfs_extent parameter at<br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="http://www.mapserver.org/ogc/wfs_server.html#layer-object">http://www.mapserver.org/ogc/wfs_server.html#layer-object</a><br clear="none"><br clear="none">Then, next step is always to execute a GetCapabilities request and go<br clear="none">through that response and make sure there are no "WARNING" messages, and<br clear="none">make the changes in the mapfile to remove those warnings if necessary...<br clear="none"><br clear="none">-jeff<br clear="none"><br clear="none"><br clear="none">--<br clear="none">Jeff McKenna<br clear="none">MapServer Consulting and Training Services<br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="http://www.gatewaygeomatics.com/">http://www.gatewaygeomatics.com/</a><br clear="none"><br clear="none"><br clear="none"><br clear="none"><br clear="none">On 2017-04-26 10:42 AM, Kajod Sharma wrote:<br clear="none">> Hi,<br clear="none">><br clear="none">> Greetings!<br clear="none">><br clear="none">> I hope this is a right platform to discuss my query regarding FILTER<br clear="none">> applied on MapServer WFS.<br clear="none">><br clear="none">> I'm new in this area and exploring some features of MapServer. I want to<br clear="none">> use GetFeature request of WFS to get features applied on any location on<br clear="none">> map. I'm using "MapServer version 7.0.4 (MS4W 3.2.1)" and trying to<br clear="none">> apply filter "Contains" for it.<br clear="none">><br clear="none">> I can see two problems when it applies Filter query on PostGIS:<br clear="none">><br clear="none">> 1. It looks it adds an extra default geospatial filter in it while<br clear="none">> making a query to PostGIS. This default spatial filter is not stopping<br clear="none">> to return any result from PostGIS. Is there any way to exclude this<br clear="none">> default filter?<br clear="none">> 2. It seems Contains coordinates are not transformed properly according<br clear="none">> to SRS of data in PostGIS.<br clear="none">><br clear="none">> I've tries with different projection in map file and request message<br clear="none">> with no success.<br clear="none">><br clear="none">> Supporting data to give your input on my queries:<br clear="none">><br clear="none">> WFS request<br clear="none">> *************************<br clear="none">> Formatted Version:<br clear="none">><br clear="none">> http://localhost/cgi-bin/mapserv.exe?<br clear="none">> service=WFS&<br clear="none">> map=C:/Data/MapServerWFSSample.map&<br clear="none">> request=GetFeature&<br clear="none">> version=2.0.0&<br clear="none">> typeName=SampleLayer&<br clear="none">> FILTER=<Filter xmlns="<a rel="nofollow" shape="rect" target="_blank" href="http://www.opengis.net/ogc">http://www.opengis.net/ogc</a>"<br clear="none">> xmlns:gml="<a rel="nofollow" shape="rect" target="_blank" href="http://www.opengis.net/gml">http://www.opengis.net/gml</a>"<br clear="none">> xmlns:ms="<a rel="nofollow" shape="rect" target="_blank" href="http://mapserver.gis.umn.edu/mapserver">http://mapserver.gis.umn.edu/mapserver</a>"><br clear="none">> <*Contains*><br clear="none">> <PropertyName>wkb_Geometry</PropertyName><br clear="none">> <gml:Point srsName="urn:ogc:def:crs:EPSG::4326"><br clear="none">> <gml:coordinates>0.112034,53.567972</gml:coordinates><br clear="none">> </gml:Point><br clear="none">> </*Contains*><br clear="none">> </Filter><br clear="none">> *************************<br clear="none">><br clear="none">> PostGIS query [Could see in log file]:<br clear="none">> *************************<br clear="none">> msPostGISLayerWhichShapes query: select<br clear="none">> "Attribute1","Attribute2","Attribute3",encode(ST_AsBinary(ST_Force2D("wkb_geometry"),'NDR'),'hex')<br clear="none">> as geom from SampleGeoDataTable where */wkb_geometry &&<br clear="none">> ST_GeomFromText('POLYGON((-0.999462804873474<br clear="none">> -1.00102606014116,-0.999462804873474<br clear="none">> -1.00102606014116,-0.999462804873474<br clear="none">> -1.00102606014116,-0.999462804873474<br clear="none">> -1.00102606014116,-0.999462804873474<br clear="none">> -1.00102606014116))',find_srid('','SampleGeoDataTable','wkb_geometry'))/* and<br clear="none">> (st_contains(wkb_geometry,ST_GeomFromText('POINT<br clear="none">> (*/7853690.3631838141000000 -5506204.5232773330000000/*)')) = TRUE)<br clear="none">> *************************<br clear="none">><br clear="none">> Similar WFS query to GeoServer works perfectly.<br clear="none">><br clear="none">> It would be very helpful if someone can help me on it. Thanks a lot in<br clear="none">> advance.<br clear="none">><br clear="none">> Map File looks like:<br clear="none">><br clear="none">> **************************************************<br clear="none">> MAP<br clear="none">> NAME "Sample_WMS"<br clear="none">> CONFIG "PROJ_LIB" "C:\ms4w\proj\nad"<br clear="none">> CONFIG "MS_ERRORFILE" "C:/Data/ms_tmp/ms_error.txt"<br clear="none">> CONFIG "CPL_DEBUG" "ON"<br clear="none">> CONFIG "PROJ_DEBUG" "ON"<br clear="none">> STATUS ON<br clear="none">> PROJECTION<br clear="none">> "init=epsg:27700"<br clear="none">> END<br clear="none">><br clear="none">> WEB<br clear="none">> IMAGEPATH "C:/Data/ms_tmp/"<br clear="none">> IMAGEURL "/ms_tmp/"<br clear="none">> METADATA<br clear="none">> "wfs_enable_request" "*"<br clear="none">> "wfs_title" "My Global Map WFS Server"<br clear="none">> "wfs_srs" "EPSG:4326 EPSG:900913 EPSG:27700"<br clear="none">> "wfs_boundingbox" "EPSG:27700 749.099975585938 -90036.5<br clear="none">> 660460.875 1227306.5"<br clear="none">> END<br clear="none">> END<br clear="none">><br clear="none">> LAYER<br clear="none">> NAME "SampleLayer"<br clear="none">> STATUS DEFAULT<br clear="none">> TYPE POLYGON<br clear="none">> PROJECTION<br clear="none">> "init=epsg:27700"<br clear="none">> END<br clear="none">> CONNECTIONTYPE POSTGIS<br clear="none">> CONNECTION "host=localhost port=5432 dbname=SampleGeoDataTable<br clear="none">> user=postgres password=hahaha"<br clear="none">> DATA "wkb_geometry from SampleLayer"<br clear="none">> CLASS<br clear="none">> STYLE<br clear="none">> COLOR 0 100 255<br clear="none">> OUTLINECOLOR 0 0 0<br clear="none">> END<br clear="none">> END<br clear="none">><br clear="none">> METADATA<br clear="none">> "wfs_enable_request" "*"<br clear="none">> "wfs_title" "Sample WFS"<br clear="none">> "wfs_srs" "EPSG:27700 EPSG:4326 EPSG:900913"<br clear="none">> "wfs_boundingbox" "EPSG:27700 749.099975585938 -90036.5<br clear="none">> 660460.875 1227306.5"<br clear="none">> "gml_include_items" "all"<br clear="none">> END<br clear="none">> END<br clear="none">> END<br clear="none">> **************************************************<br clear="none">><br clear="none">> Regards,<br clear="none">> Kajod<br clear="none">><br clear="none">><br clear="none"><br clear="none"><br clear="none">_______________________________________________<br clear="none">mapserver-users mailing list<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:mapserver-users@lists.osgeo.org" target="_blank" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="https://lists.osgeo.org/mailman/listinfo/mapserver-users">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><div class="yiv6862950439yqt4043667530" id="yiv6862950439yqtfd04538"><br clear="none">_______________________________________________<br clear="none">mapserver-users mailing list<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:mapserver-users@lists.osgeo.org" target="_blank" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="https://lists.osgeo.org/mailman/listinfo/mapserver-users">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a></div></div><br clear="none"><br clear="none"></div> </div> </div> </div></div></div></div></div><br><br></div> </div> </div> </div></div></body></html>