title: OpenLayers 3: Geometric filters in method WFS GetFeature
body: <p>OpenLayers 2 could generate geometric filter method WFS GetFeature.  </p>
  
  <p>Example JS:  </p>
  
  <pre><code>var filter = new OpenLayers.Filter.Spatial({ type: OpenLayers.Filter.Spatial.INTERSECTS, value: geometry, projection: "EPSG:3067" });
  
  var parser = new OpenLayers.Format.Filter.v1_1_0();
  var filterAsXml = parser.write(filter);
  var xml = new OpenLayers.Format.XML();
  var filterAsString = xml.write( filterAsXml );  
  </code></pre>
  
  <p>Example XML:</p>
  
  <pre><code>&lt;wfs:GetFeature
    xmlns:wfs="http://www.opengis.net/wfs"
    service="WFS"
    version="1.1.0"
    outputFormat="json"
    xsi:schemaLocation="http://www.opengis.net/wfs
    http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  &lt;wfs:Query typeName="LiVi:LIIKENNE_ELEMENTTI" srsName="EPSG:3067" xmlns:LiVi="http://site.ru/"&gt;
      &lt;ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"&gt;
        &lt;ogc:Intersects&gt;
          &lt;ogc:PropertyName&gt;GEOMETRY&lt;/ogc:PropertyName&gt;
          &lt;gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:3067"&gt;
            &lt;gml:exterior&gt;
              &lt;gml:LinearRing&gt;
                &lt;gml:posList&gt;308082.07106781186 6833724.928932188 308082.07106781186 6833739.071067812 308067.92893218814 6833739.071067812 308067.92893218814 6833724.928932188 308082.07106781186 6833724.928932188&lt;/gml:posList&gt;
              &lt;/gml:LinearRing&gt;
            &lt;/gml:exterior&gt;
          &lt;/gml:Polygon&gt;
        &lt;/ogc:Intersects&gt;
      &lt;/ogc:Filter&gt;
    &lt;/wfs:Query&gt;
  &lt;/wfs:GetFeature&gt;
  </code></pre>
  
  <p>They have a not working <a href="http://openlayers.org/en/latest/apidoc/ol.format.ogc.filter.html" rel="nofollow">example</a>:    </p>
  
  <blockquote>
  <pre><code>var f = ol.format.wfs.filter;
  var request = new ol.format.WFS().writeGetFeature({
      srsName: 'urn:ogc:def:crs:EPSG::4326',
      featureNS: 'http://www.openplans.org/topp',
      featurePrefix: 'topp',
      featureTypes: ['states'],
      filter: f.and(
        f.bbox('the_geom', [1, 2, 3, 4], 'urn:ogc:def:crs:EPSG::4326'),
        f.like('name', 'New*')
      )
  });  
  </code></pre>
  </blockquote>
  
  <p>Either he recently appeared... Judging by the projection - a blank for WFS 2.0.0.  </p>
  
  <p>How do I write a geometric filter in the OL3?  </p>
  
  <p><strong><em>PS2</strong><br>
  Sorry for my English.</em>  </p>