[mapserver-users] Problem GetFeature with geom filter on WFS

Stéphane Brunner stephane.brunner at camptocamp.com
Thu Jul 28 07:18:49 PDT 2011


Hello,

I log the sql request on spatial filter and I have this:
select "oid","nummer","gemeinde","gueltigkeit","flgrundb","quote","eigentuemer","adresse_lang",encode(ST_AsBinary(ST_Force_2D("geom"),'NDR'),'hex')
as geom,"oid" from (SELECT oid, t1.geom, t1.nummer, t2.gemeinde,
t1.gueltigkeit1_txt as gueltigkeit, t2.flgrundb, ((t2.zaehler::text ||
'/'::text) || t2.nenner::text) AS quote, t2.eigentuemer,
(((t2.adresse::text || ', '::text) || t2.plz::text) || ' '::text) ||
t2.ort::text AS adresse_lang FROM av.liegenschaften_liegenschaft_area
as t1, av.view_gemlis_geomaste_parzelle as t2 WHERE t1.gdid = t2.gdeid
and t1.nummer = t2.parznr::text) AS foo where geom &&
GeomFromText('POLYGON((620000 218000,620000 278000,690000
278000,690000 218000,620000 218000))',-1) limit 100

I didn't see any postggis filter than I try to do a spatial filter on
one of the 100 first results
Than I have a correct result ...

Than why mapserver doesn't use postgis spatial filter ? Does I miss something ?

Thank-you in advance
Stéphane Brunner



2011/7/26 Stéphane Brunner <stephane.brunner at camptocamp.com>:
> Hello,
>
> I just test it with a shape file, and it's working...
> I will investigate a little bit more to know why it's not working with postgres.
>
> Sincerely
> Stéphane Brunner
>
>
> 2011/7/25 Steve Lime <sdlime at gmail.com>:
>> Never mind on version, I saw 6.0.0 in the response... ;-) Steve
>>
>> On Mon, Jul 25, 2011 at 6:19 AM, Stéphane Brunner
>> <stephane.brunner at camptocamp.com> wrote:
>>>
>>> Hello,
>>>
>>> I have the mapfile [0]. when I done a GetFeature on the nummer [1] I
>>> have 4 results [2] (with duplicate but it's an other issue).
>>> When I done a spatial filter [3] I have no results [4] but I should
>>> have at least one result ...
>>>
>>> Thanks in advance for having a look on this issue.
>>>
>>> Sincerely yours
>>> Stéphane Brunner
>>>
>>> Following: specified, GetCapabilities [5], describefeaturetype [6].
>>>
>>> mapfile [0]:
>>> MAP
>>>    NAME "map"
>>>
>>>    EXTENT 620000 218000 690000 278000
>>>
>>>    UNITS METERS
>>>    IMAGETYPE jpeg
>>>    RESOLUTION 72
>>>    DEFRESOLUTION 72
>>>    IMAGECOLOR 255 255 255
>>>    STATUS ON
>>>    FONTSET "fonts.conf"
>>>    SYMBOLSET "symbole.sym"
>>>    MAXSIZE 5000
>>>
>>>    PROJECTION
>>>        "init=epsg:21781"
>>>    END
>>>
>>>    ####
>>>    # Used by overlays
>>>    ####
>>>    OUTPUTFORMAT
>>>        NAME png256
>>>        DRIVER AGG/PNG
>>>        MIMETYPE "image/png256"
>>>        IMAGEMODE RGBA
>>>        EXTENSION "png"
>>>        FORMATOPTION "INTERLACE=OFF"
>>>        FORMATOPTION "QUANTIZE_FORCE=ON"
>>>        FORMATOPTION "QUANTIZE_DITHER=OFF"
>>>        FORMATOPTION "QUANTIZE_COLORS=256"
>>>    END
>>>    OUTPUTFORMAT
>>>        NAME png
>>>        DRIVER AGG/PNG
>>>        MIMETYPE "image/png"
>>>        IMAGEMODE RGBA
>>>        EXTENSION "png"
>>>        FORMATOPTION "INTERLACE=OFF"
>>>        FORMATOPTION "QUANTIZE_DITHER=OFF"
>>>    END
>>>
>>>    WEB
>>>        METADATA
>>>            "ows_title" "map"
>>>            "ows_srs" "epsg:21781"
>>>            "ows_encoding" "UTF-8"
>>>            "wms_feature_info_mime_type" "application/vnd.ogc.gml"
>>>            "wms_enable_request" "*"
>>>            "ows_enable_request" "*"
>>>            "gml_include_items" "all"
>>>            "gml_featureid" "id"
>>>            "wfs_title" "map"
>>>            "wfs_srs" "epsg:21781"
>>>        END
>>>        IMAGEPATH '/var/tmp/'
>>>    END
>>>
>>>    LEGEND
>>>        IMAGECOLOR 240 240 240
>>>        LABEL
>>>            FONT arial
>>>            ANTIALIAS true
>>>            TYPE truetype
>>>            SIZE 9
>>>            COLOR 0 0 0
>>>        END
>>>    END
>>>
>>>
>>> LAYER
>>>  NAME "Liegenschaft_Query"
>>>  TYPE POLYGON
>>>  STATUS ON
>>>  TEMPLATE fooOnlyForWMSGetFeatureInfo
>>>  CONNECTIONTYPE postgis
>>>  PROCESSING "CLOSE_CONNECTION=DEFER"
>>>  CONNECTION "user=www-data password=www-data dbname=dev host=localhost"
>>>  DATA "geom from (SELECT oid, t1.geom, t1.nummer FROM
>>> av.view_i_liegenschaft_all AS t1) AS foo using unique oid using
>>> SRID=-1"
>>> #  GROUP "TOPIC_Liegenschaften_LN"
>>>  EXTENT 620000 218000 690000 278000
>>>  METADATA
>>>    "ows_title" "Liegenschaft_Query"
>>>    "ows_srs" "epsg:21781"
>>>    "id_attribute_string" "oid"
>>>    "ows_featureid" "oid"
>>>    "ows_geometries" "geom"
>>>    "ows_geom_type" "polygon"
>>>    "query_returned_attributes" "nummer"
>>>    "gml_include_items" "oid,nummer,geom"
>>>    "gml_geometries" "geom"
>>>    "gml_geom_type" "polygon"
>>>    "gml_nummer_type" "Character"
>>>    #"gml_groups" "TOPIC_Liegenschaften_LN"
>>>    "gml_featureid" "oid"
>>>    "wfs_title" "Liegenschaft_Query"
>>>    "wfs_srs" "epsg:21781"
>>>  END
>>>  DUMP TRUE
>>>  PROJECTION
>>>      "init=epsg:21781"
>>>  END
>>>
>>>  CLASS
>>>    NAME "Liegenschaft"
>>>    STYLE
>>>      SYMBOL "circle"
>>>      SIZE 3
>>>      OUTLINECOLOR 0 0 0
>>>    END
>>>  END
>>> END
>>> END
>>>
>>> query on the nummer [1]:
>>> <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS"
>>> version="1.0.0" maxFeatures="100"
>>> xsi:schemaLocation="http://www.opengis.net/wfs
>>> http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>> <wfs:Query typeName="feature:Liegenschaft_Query"
>>> xmlns:feature="http://mapserver.gis.umn.edu/mapserver">
>>> <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
>>> <ogc:PropertyIsEqualTo>
>>> <ogc:PropertyName>nummer</ogc:PropertyName>
>>> <ogc:Literal>3634</ogc:Literal>
>>> </ogc:PropertyIsEqualTo>
>>> </ogc:Filter>
>>> </wfs:Query>
>>> </wfs:GetFeature>
>>>
>>> response on the nummer [2]:
>>> <?xml version='1.0' encoding="UTF-8" ?>
>>> <wfs:FeatureCollection
>>>   xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
>>>   xmlns:wfs="http://www.opengis.net/wfs"
>>>   xmlns:gml="http://www.opengis.net/gml"
>>>   xmlns:ogc="http://www.opengis.net/ogc"
>>>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>   xsi:schemaLocation="http://www.opengis.net/wfs
>>> http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd
>>>                       http://mapserver.gis.umn.edu/mapserver
>>>
>>> http://c2cpc89.camptocamp.com/sbrunner/mapserv?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=feature:Liegenschaft_Query&OUTPUTFORMAT=XMLSCHEMA">
>>>      <gml:boundedBy>
>>>        <gml:Box srsName="EPSG:21781">
>>>                <gml:coordinates>661054.808000,244611.321000
>>> 663053.704000,244888.622000</gml:coordinates>
>>>        </gml:Box>
>>>      </gml:boundedBy>
>>>    <gml:featureMember>
>>>      <ms:Liegenschaft_Query fid="Liegenschaft_Query.2380997">
>>>        <gml:boundedBy>
>>>                <gml:Box srsName="EPSG:21781">
>>>                        <gml:coordinates>661054.808000,244854.251000
>>> 661088.687000,244888.622000</gml:coordinates>
>>>                </gml:Box>
>>>        </gml:boundedBy>
>>>        <ms:geom>
>>>        <gml:Polygon srsName="EPSG:21781">
>>>          <gml:outerBoundaryIs>
>>>            <gml:LinearRing>
>>>              <gml:coordinates>661076.579000,244888.622000
>>> 661054.808000,244875.484000 661062.744000,244858.448000
>>> 661064.653000,244854.251000 661088.687000,244869.173000
>>> 661076.579000,244888.622000 </gml:coordinates>
>>>            </gml:LinearRing>
>>>          </gml:outerBoundaryIs>
>>>        </gml:Polygon>
>>>        </ms:geom>
>>>        <ms:oid>2380997</ms:oid>
>>>        <ms:nummer>3634</ms:nummer>
>>>      </ms:Liegenschaft_Query>
>>>    </gml:featureMember>
>>>    <gml:featureMember>
>>>      <ms:Liegenschaft_Query fid="Liegenschaft_Query.2380997">
>>>        <gml:boundedBy>
>>>                <gml:Box srsName="EPSG:21781">
>>>                        <gml:coordinates>661054.808000,244854.251000
>>> 661088.687000,244888.622000</gml:coordinates>
>>>                </gml:Box>
>>>        </gml:boundedBy>
>>>        <ms:geom>
>>>        <gml:Polygon srsName="EPSG:21781">
>>>          <gml:outerBoundaryIs>
>>>            <gml:LinearRing>
>>>              <gml:coordinates>661076.579000,244888.622000
>>> 661054.808000,244875.484000 661062.744000,244858.448000
>>> 661064.653000,244854.251000 661088.687000,244869.173000
>>> 661076.579000,244888.622000 </gml:coordinates>
>>>            </gml:LinearRing>
>>>          </gml:outerBoundaryIs>
>>>        </gml:Polygon>
>>>        </ms:geom>
>>>        <ms:oid>2380997</ms:oid>
>>>        <ms:nummer>3634</ms:nummer>
>>>      </ms:Liegenschaft_Query>
>>>    </gml:featureMember>
>>>    <gml:featureMember>
>>>      <ms:Liegenschaft_Query fid="Liegenschaft_Query.2384539">
>>>        <gml:boundedBy>
>>>                <gml:Box srsName="EPSG:21781">
>>>                        <gml:coordinates>663017.565000,244611.321000
>>> 663053.704000,244650.084000</gml:coordinates>
>>>                </gml:Box>
>>>        </gml:boundedBy>
>>>        <ms:geom>
>>>        <gml:Polygon srsName="EPSG:21781">
>>>          <gml:outerBoundaryIs>
>>>            <gml:LinearRing>
>>>              <gml:coordinates>663017.565000,244635.722000
>>> 663033.235000,244611.321000 663045.949000,244619.485000
>>> 663053.704000,244626.417000 663034.337000,244650.084000
>>> 663017.565000,244635.722000 </gml:coordinates>
>>>            </gml:LinearRing>
>>>          </gml:outerBoundaryIs>
>>>        </gml:Polygon>
>>>        </ms:geom>
>>>        <ms:oid>2384539</ms:oid>
>>>        <ms:nummer>3634</ms:nummer>
>>>      </ms:Liegenschaft_Query>
>>>    </gml:featureMember>
>>>    <gml:featureMember>
>>>      <ms:Liegenschaft_Query fid="Liegenschaft_Query.2384539">
>>>        <gml:boundedBy>
>>>                <gml:Box srsName="EPSG:21781">
>>>                        <gml:coordinates>663017.565000,244611.321000
>>> 663053.704000,244650.084000</gml:coordinates>
>>>                </gml:Box>
>>>        </gml:boundedBy>
>>>        <ms:geom>
>>>        <gml:Polygon srsName="EPSG:21781">
>>>          <gml:outerBoundaryIs>
>>>            <gml:LinearRing>
>>>              <gml:coordinates>663017.565000,244635.722000
>>> 663033.235000,244611.321000 663045.949000,244619.485000
>>> 663053.704000,244626.417000 663034.337000,244650.084000
>>> 663017.565000,244635.722000 </gml:coordinates>
>>>            </gml:LinearRing>
>>>          </gml:outerBoundaryIs>
>>>        </gml:Polygon>
>>>        </ms:geom>
>>>        <ms:oid>2384539</ms:oid>
>>>        <ms:nummer>3634</ms:nummer>
>>>      </ms:Liegenschaft_Query>
>>>    </gml:featureMember>
>>> </wfs:FeatureCollection>
>>>
>>>
>>> query with spatial filter [3]:
>>> <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS"
>>> version="1.0.0" maxFeatures="100"
>>> xsi:schemaLocation="http://www.opengis.net/wfs
>>> http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>> <wfs:Query typeName="feature:Liegenschaft_Query"
>>> xmlns:feature="http://mapserver.gis.umn.edu/mapserver">
>>> <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
>>> <ogc:Intersects>
>>> <ogc:PropertyName>geom</ogc:PropertyName>
>>> <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:21781">
>>> <gml:coordinates decimal="." cs="," ts="
>>> ">661070.024,244872.084</gml:coordinates>
>>> </gml:Point>
>>> </ogc:Intersects>
>>> </ogc:Filter>
>>> </wfs:Query>
>>> </wfs:GetFeature>
>>>
>>>
>>> response with spatial filter [4]:
>>> <?xml version='1.0' encoding="UTF-8" ?>
>>> <wfs:FeatureCollection
>>>   xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
>>>   xmlns:wfs="http://www.opengis.net/wfs"
>>>   xmlns:gml="http://www.opengis.net/gml"
>>>   xmlns:ogc="http://www.opengis.net/ogc"
>>>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>   xsi:schemaLocation="http://www.opengis.net/wfs
>>> http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd
>>>                       http://mapserver.gis.umn.edu/mapserver
>>>
>>> http://c2cpc89.camptocamp.com/sbrunner/mapserv?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=feature:Liegenschaft_Query&OUTPUTFORMAT=XMLSCHEMA">
>>>   <gml:boundedBy>
>>>      <gml:null>missing</gml:null>
>>>   </gml:boundedBy>
>>> </wfs:FeatureCollection>
>>>
>>>
>>> GetCapabilities [5]:
>>> <?xml version='1.0' encoding="UTF-8" ?>
>>> <WFS_Capabilities
>>>   version="1.0.0"
>>>   updateSequence="0"
>>>   xmlns="http://www.opengis.net/wfs"
>>>   xmlns:ogc="http://www.opengis.net/ogc"
>>>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>   xsi:schemaLocation="http://www.opengis.net/wfs
>>> http://schemas.opengis.net/wfs/1.0.0/WFS-capabilities.xsd">
>>>
>>> <!-- MapServer version 6.0.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG
>>> SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=CAIRO SUPPORTS=OPENGL
>>> SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER
>>> SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT
>>> SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI
>>> SUPPORTS=THREADS SUPPORTS=GEOS INPUT=POSTGIS INPUT=OGR INPUT=GDAL
>>> INPUT=SHAPEFILE -->
>>>
>>> <Service>
>>>  <Name>MapServer WFS</Name>
>>>  <Title>Amtliche Vermessung</Title>
>>>  <Abstract>Die amtliche Vermessung nach DM01 Darstellung als WMS
>>> Dienst für MapFish Projekte</Abstract>
>>>
>>>  <OnlineResource>http://c2cpc89.camptocamp.com/sbrunner/mapserv?</OnlineResource>
>>>
>>> </Service>
>>>
>>> <Capability>
>>>  <Request>
>>>    <GetCapabilities>
>>>      <DCPType>
>>>        <HTTP>
>>>          <Get
>>> onlineResource="http://c2cpc89.camptocamp.com/sbrunner/mapserv?"
>>> />
>>>        </HTTP>
>>>      </DCPType>
>>>
>>>      <DCPType>
>>>        <HTTP>
>>>          <Post
>>> onlineResource="http://c2cpc89.camptocamp.com/sbrunner/mapserv?" />
>>>        </HTTP>
>>>      </DCPType>
>>>    </GetCapabilities>
>>>    <DescribeFeatureType>
>>>      <SchemaDescriptionLanguage>
>>>        <XMLSCHEMA/>
>>>
>>>      </SchemaDescriptionLanguage>
>>>      <DCPType>
>>>        <HTTP>
>>>          <Get
>>> onlineResource="http://c2cpc89.camptocamp.com/sbrunner/mapserv?"
>>> />
>>>        </HTTP>
>>>      </DCPType>
>>>      <DCPType>
>>>        <HTTP>
>>>          <Post
>>> onlineResource="http://c2cpc89.camptocamp.com/sbrunner/mapserv?" />
>>>
>>>        </HTTP>
>>>      </DCPType>
>>>    </DescribeFeatureType>
>>>    <GetFeature>
>>>      <ResultFormat>
>>>        <GML2/>
>>>      </ResultFormat>
>>>      <DCPType>
>>>        <HTTP>
>>>
>>>          <Get
>>> onlineResource="http://c2cpc89.camptocamp.com/sbrunner/mapserv?"
>>> />
>>>        </HTTP>
>>>      </DCPType>
>>>      <DCPType>
>>>        <HTTP>
>>>          <Post
>>> onlineResource="http://c2cpc89.camptocamp.com/sbrunner/mapserv?" />
>>>        </HTTP>
>>>      </DCPType>
>>>    </GetFeature>
>>>
>>>  </Request>
>>> </Capability>
>>>
>>> <FeatureTypeList>
>>>  <Operations>
>>>    <Query/>
>>>  </Operations>
>>>    <FeatureType>
>>>        <Name>Liegenschaft_Query</Name>
>>>        <Title>Liegenschaft_Query</Title>
>>>
>>>        <SRS>epsg:21781</SRS>
>>>        <LatLongBoundingBox minx="620000" miny="218000" maxx="690000"
>>> maxy="278000" />
>>>    </FeatureType>
>>>    <FeatureType>
>>>        <Name>Liegenschaft_Query_ALL</Name>
>>>        <Title>Liegenschaft_Query_ALL</Title>
>>>        <SRS>epsg:21781</SRS>
>>>
>>>        <LatLongBoundingBox minx="620000" miny="218000" maxx="690000"
>>> maxy="278000" />
>>>    </FeatureType>
>>> </FeatureTypeList>
>>>
>>> <ogc:Filter_Capabilities>
>>>  <ogc:Spatial_Capabilities>
>>>    <ogc:Spatial_Operators>
>>>      <ogc:Equals/>
>>>      <ogc:Disjoint/>
>>>      <ogc:Touches/>
>>>
>>>      <ogc:Within/>
>>>      <ogc:Overlaps/>
>>>      <ogc:Crosses/>
>>>      <ogc:Intersect/>
>>>      <ogc:Contains/>
>>>      <ogc:DWithin/>
>>>      <ogc:BBOX/>
>>>    </ogc:Spatial_Operators>
>>>  </ogc:Spatial_Capabilities>
>>>
>>>  <ogc:Scalar_Capabilities>
>>>    <ogc:Logical_Operators />
>>>    <ogc:Comparison_Operators>
>>>      <ogc:Simple_Comparisons />
>>>      <ogc:Like />
>>>      <ogc:Between />
>>>    </ogc:Comparison_Operators>
>>>  </ogc:Scalar_Capabilities>
>>> </ogc:Filter_Capabilities>
>>> </WFS_Capabilities>
>>>
>>>
>>> describefeaturetype [6]:
>>> <?xml version='1.0' encoding="UTF-8" ?>
>>> <schema
>>>   targetNamespace="http://mapserver.gis.umn.edu/mapserver"
>>>   xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
>>>   xmlns:ogc="http://www.opengis.net/ogc"
>>>   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>>   xmlns="http://www.w3.org/2001/XMLSchema"
>>>   xmlns:gml="http://www.opengis.net/gml"
>>>   elementFormDefault="qualified" version="0.1" >
>>>
>>>  <import namespace="http://www.opengis.net/gml"
>>>          schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"
>>> />
>>>
>>>  <element name="Liegenschaft_Query"
>>>           type="ms:Liegenschaft_QueryType"
>>>           substitutionGroup="gml:_Feature" />
>>>
>>>  <complexType name="Liegenschaft_QueryType">
>>>    <complexContent>
>>>      <extension base="gml:AbstractFeatureType">
>>>        <sequence>
>>>
>>>          <element name="geom" type="gml:PolygonPropertyType"
>>> minOccurs="0" maxOccurs="1"/>
>>>          <element name="oid" type="string"/>
>>>          <element name="nummer" type="Character"/>
>>>        </sequence>
>>>      </extension>
>>>    </complexContent>
>>>  </complexType>
>>>
>>> </schema>
>>>
>>>
>>> --
>>> camptocamp.com
>>> mapfish.org
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>>
>
>
>
> --
> camptocamp.com
> mapfish.org
>



-- 
camptocamp.com
mapfish.org



More information about the MapServer-users mailing list