[OpenLayers-Users] OpenLayers / Mapserver WFS Filter: <gml:null>missing</gml:null>

Francesco de Virgilio fradeve11 at gmail.com
Fri Oct 12 09:58:17 PDT 2012


I'm trying to filter features in OpenLayers when moving a JQueryUI
slider. It works as follows.

Full files available [here on GitHub](https://github.com/fradeve/ark-oia).

## JQueryUI slider ##
#####################

When moving the slider cursor, `minSelection` and `maxSelection` values are defined.
I need to show only features with `minSelection < height < maxSelection`.
I've defined a filter that takes the current `min` and `maxSelection` and makes a query
on the WFS, applying it to the vector layer (`curlayer` is the current vector layer object):

    heightFilter = new OpenLayers.Filter.Comparison({
        type: OpenLayers.Filter.Comparison.BETWEEN,
        property: 'height',
        lowerBoundary: minSelection,
        upperBoundary: maxSelection
    });

    curlayer.filter = heightFilter;
    curlayer.refresh({force: true})

## OpenLayers.js ##
###################

    var _projObj = {
        wgs84 : new OpenLayers.Projection('EPSG:4326'),
        mercator : new OpenLayers.Projection('EPSG:900913'),
        osm_wms : new OpenLayers.Projection('EPSG:3857')
    };

    uses_layer = new OpenLayers.Layer.Vector("US Layer", {
        strategies : [new OpenLayers.Strategy.Fixed()],
        projection : _projObj.wgs84,
        visibility : true,
        displayInLayerSwitcher : false,
        protocol : new OpenLayers.Protocol.WFS({
            version : '1.0.0',
            url : 'http://46.105.19.68/cgi-bin/mapserv?map=/home/fradeve/public_html/ark-oia/ark-scrmap/wfs.map&service=WFS',
            featureType : USType
        })
    });

## Mapserver ##
###############

    LAYER
        CONNECTION "host=46.105.19.68 user=** password=** dbname=sipdb"
        CONNECTIONTYPE POSTGIS
        DATA "geometry from (select gid, layer, the_geom as geometry, n1, n2, n13 as height from us) as pseudo_table using unique gid using srid=4326"
        NAME "us"
        DUMP TRUE
        METADATA
            "wfs_srs"         "EPSG:4326"
            "gml_featureid"   "gid"
            "wfs_title"       "us"
            "wfs_typename"    "us"
            "gml_include_items"       "all"
            "wfs_version"     "1.0.0" 
            "wfs_enable_request" "*" 
        END
        PROJECTION
            "init=epsg:4326"
        END
        STATUS ON
        TYPE Polygon
        UNITS METERS
        CLASS 
            STYLE
                ANGLE 360
                ANTIALIAS TRUE
                WIDTH 1
            END
        END
    END

## The XHTTP Post response ##
#############################

Here is what I get when moving around the slider cursor:

### Request payload ###

    <?xml version="1.0" encoding="UTF-8"?>
    <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="WFS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd">
    <wfs:Query xmlns:feature="http://localhost/cgi-bin/mapserv.exe" typeName="feature:us">
      <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
         <ogc:PropertyIsBetween>
            <ogc:PropertyName>height</ogc:PropertyName>
            <ogc:LowerBoundary>
               <ogc:Literal>870</ogc:Literal>
            </ogc:LowerBoundary>
            <ogc:UpperBoundary>
               <ogc:Literal>900</ogc:Literal>
            </ogc:UpperBoundary>
         </ogc:PropertyIsBetween>
      </ogc:Filter>
     </wfs:Query>
    </wfs:GetFeature>

### Response ###

    <?xml version="1.0" encoding="UTF-8"?>
    <wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs"
                           xmlns:ms="http://localhost/cgi-bin/mapserv.exe"
                           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://localhost/cgi-bin/mapserv.exe http://46.105.19.68/cgi-bin/mapserv?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=feature:us&OUTPUTFORMAT=XMLSCHEMA">
        <gml:boundedBy>
            <gml:null>missing</gml:null>
        </gml:boundedBy>
    </wfs:FeatureCollection>

## So... ##
###########

Where is the error? Everything seems fine to me...


Thank you and soddy for the long mail :)
-- 
Francesco de Virgilio
*Ubuntu-it team member*
   mailto:fradeve at ubuntu-it.org
   http://wiki.ubuntu-it.org/FrancescoDeVirgilio
*Wikimedia projects contributor*
   http://en.wikipedia.org/wiki/User:Fradeve11
*OpenStreetMap Mapper*
   http://www.openstreetmap.org/user/Fradeve11
*Blog*
   http://www.fradeve.org
		"Love - Peace - Freedom - Free Software"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20121012/09e0d16a/attachment.pgp>


More information about the Users mailing list