Added by madair, last edited by madair on Aug 24, 2006

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.

From the OGC Filter encoding page at http://www.opengeospatial.org/standards/filter

The OpenGIS® Filter Encoding Implementation Specification defines an XML encoding for filter expressions. A filter expression constrains property values to create a subset of a group of objects. The goal, typically, is to operate on just those objects by, for example, rendering them in a different color or saving them to another format.

The filter encoding specified in this document is a common component that can be used by a number of OGC Web Services. Any service that requires the ability to query objects from a Web-accessible repository can make use of the XML filter encoding described in this document. For example, a Web feature service may use the XML filter encoding in a GetFeature operation to define query constraints.

Filters are considered to be Models in MapBuilder since they consist of an XML document fragment.  Form widgets are then used to set the property values in the filter. An example of the use of Filters is in the GazetteerTools demo in the MapBuilder distribution.

An example config file fragment:

<Model id="worldPlaceFilter">
  <defaultModelUrl>gnisFilter.xml</defaultModelUrl>
  <widgets>
    <PlaceNameForm id="worldPlaceNameForm">
      <stylesheet>WorldPlaceNameForm.xsl</stylesheet>
      <targetModel>placeNameWorld</targetModel>
      <featureTypeName>topp:gnis</featureTypeName>
    </PlaceNameForm>
  </widgets>
</Model> 

The initial implementation of Filters in MapBuilder uses hard-coded filter templates in static XML files  for the filter expression.  It is envisaged that support for more dynamic filter expressions will eventually be developed.  An example of a filter is below:

<Filter>
  <And>
    <PropertyIsLike wildCard="*" singleChar="." escape="\">
      <PropertyName>topp:full_name_lc</PropertyName>
      <Literal></Literal>
    </PropertyIsLike>
    <PropertyIsLike wildCard="*" singleChar="." escape="\">
      <PropertyName>topp:country_name</PropertyName>
      <Literal></Literal>
    </PropertyIsLike>
  </And>
</Filter>

The form widget is then coded to fill in the <Literal> elements.  The completed Filter expression then gets inserted into the WebServiceRequest either by appending it as a node for POST or by serializing the expresiion into a string for GET requests.