[mapserver-users] Submitting filter does not filter - returns all features

Rahkonen Jukka jukka.rahkonen at mmmtike.fi
Tue Sep 24 07:09:22 PDT 2013


Hi,

I had a try and this with units='meters'
http://hip.latuviitta.org/cgi-bin/mapserver_wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=getfeature&TYPENAME=lv:mml_railway&SRSNAME=EPSG:3067&Filter=%3CFilter%3E%3CDWithin%3E%3CPropertyName%3Ethe_geom%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E246700,6780800%3C/gml:coordinates%3E%3C/gml:Point%3E%3CDistance%20units=%27meters%27%3E4000%3C/Distance%3E%3C/DWithin%3E%3C/Filter%3E&MAXFEATURES=300

seem to give the same result as this one with units='degrees'
http://hip.latuviitta.org/cgi-bin/mapserver_wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=getfeature&TYPENAME=lv:mml_railway&SRSNAME=EPSG:3067&Filter=%3CFilter%3E%3CDWithin%3E%3CPropertyName%3Ethe_geom%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E246700,6780800%3C/gml:coordinates%3E%3C/gml:Point%3E%3CDistance%20units=%27meters%27%3E4000%3C/Distance%3E%3C/DWithin%3E%3C/Filter%3E&MAXFEATURES=300

The first one sent for TinyOWS does not give results at all but just an error message

http://hip.latuviitta.org/cgi-bin/tinyows?SERVICE=WFS&VERSION=1.0.0&REQUEST=getfeature&TYPENAME=lv:mml_railway&SRSNAME=EPSG:3067&Filter=%3CFilter%3E%3CDWithin%3E%3CPropertyName%3Ethe_geom%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E246700,6780800%3C/gml:coordinates%3E%3C/gml:Point%3E%3CDistance%20units=%27meters%27%3E4000%3C/Distance%3E%3C/DWithin%3E%3C/Filter%3E&MAXFEATURES=300

The error is about namespaces but Mapserver does not care about such things, which means that Mapserver users learn to write filters which do not work with almost any other WFS server.

<ows:ExceptionReport xsi:schemaLocation=
"http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd" version="1.1.0"
language="en">
<ows:Exception exceptionCode="InvalidParameterValue" locator="FILTER">
<ows:ExceptionText>Filter Element contains incoherent XML Namespaces
</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>

Isn't it fun with WFS?

-Jukka Rahkonen-


Lähettäjä: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] Puolesta Rahkonen Jukka
Lähetetty: 24. syyskuuta 2013 16:51
Vastaanottaja: 'mapserver-users at lists.osgeo.org'
Aihe: Re: [mapserver-users] Submitting filter does not filter - returns all features

Hi,

Just a guess, but using units in filters is often poorly implemented. Have a try without units and by giving the distance in degrees.

-Jukka Rahkonen-

Lähettäjä: mapserver-users-bounces at lists.osgeo.org<mailto:mapserver-users-bounces at lists.osgeo.org> [mailto:mapserver-users-bounces at lists.osgeo.org] Puolesta Troy Day
Lähetetty: 24. syyskuuta 2013 16:23
Vastaanottaja: mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
Aihe: Re: [mapserver-users] Submitting filter does not filter - returns all features

I'm looking for advice on how to pass a GET request Filter through mapserver to an oracle spatial database connection. Although I have successfully implemented a BBOX filter, both DWithin and Intersects spatial filters seem to be ignored during the query process because all features (up to MAXFEATURES) are returned. No errors are returned with debug set to 5.

Here is a sample URL:

http://wfsd.visualapms.com/wfs.php?SERVICE=WFS&VERSION=1.1.0&REQUEST=getfeature&TYPENAME=parcels&SRSNAME=EPSG:4269&OUTPUTFORMAT=json&Filter=%3CFilter%3E%3CDWithin%3E%3CPropertyName%3ESHAPE%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E-101.9378217465,36.758602636999996%3C/gml:coordinates%3E%3C/gml:Point%3E%3CDistance%20units=%27meters%27%3E200%3C/Distance%3E%3C/DWithin%3E%3C/Filter%3E&MAXFEATURES=300

Here is the filter part of that url  in xml format:

&Filter=<Filter><DWithin><PropertyName>SHAPE</PropertyName><gml:Point><gml:coordinates>-101.9378217465,36.758602636999996<gml:coordinates></gml:Point><Distance units="meters">200</Distance></DWithin></Filter>

...and here is the layer definition within the map file I'm using:

  LAYER
    NAME           "parcels"
    METADATA
      "wfs_title"                 "Parcels"
      "wfs_srs"                   "EPSG:4269"
      "gml_include_items"         "all"
      "gml_featureid"             "OBJECTID"
      "wfs_enable_request"        "*"
      "wfs_getfeature_formatlist" "gml,json,geojson"
      "gml_COUNTRY_ID_type"       "Character"
      "gml_STATE_ID_type"         "Character"
      "gml_COUNTY_ID_type"        "Character"
      "gml_PARCEL_ID_type"        "Character"
    END
    TYPE           POLYGON
    STATUS         ON
    EXTENT         -180 -90 180 90
    CONNECTIONTYPE oraclespatial
    CONNECTION     "SDE/3nz0rb4rr4g1n at ArcSDE"
    DATA           "SHAPE FROM (select OBJECTID, COUNTRY_ID, STATE_ID, COUNTY_ID, PARCEL_ID, APP_USER_G, SHAPE from PARCEL) USING FILTER"
    PROJECTION
      "init=epsg:4269"
    END
    CLASS
      NAME              "Parcels"
      STYLE
        COLOR                240 240 240
        OUTLINECOLOR           0   0   0
      END
    END
  END


Hoping others have gone down this rabbit hole...thanks for looking!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20130924/d6b85233/attachment.htm>


More information about the MapServer-users mailing list