I'm using a WFS layer and I wanna filter some features using a spatial filter. My filter is of type: DWITHIN<br><br>Here is the code:<br><font size="1"><span dir="ltr" id=":10c"><br></span></font><div style="text-align: center;">
<div style="text-align: left;"><font size="1"><b><font style="font-family: courier new,monospace; color: rgb(102, 102, 102);"><span dir="ltr" id=":10c">var point = new OpenLayers.Geometry.Point(</span><span dir="ltr" id=":10c">-122.8764, 42.3263</span><span dir="ltr" id=":10c">)</span><br>
<span dir="ltr" id=":10c">point.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:2270"));</span><br><br><span dir="ltr" id=":r8">var wfslayer = new OpenLayers.Layer.Vector("WFS", {</span><br>
<span dir="ltr" id=":r8"> strategies: [new OpenLayers.Strategy.BBOX()],</span><br><span dir="ltr" id=":r8"> protocol: new OpenLayers.Protocol.WFS({</span><br><span dir="ltr" id=":r8"> url: "<a href="http://localhost:8080/geoserver/wfs">http://localhost:8080/geoserver/wfs</a>",</span><br>
<span dir="ltr" id=":r8"> featureType: "schools",</span><br><span dir="ltr" id=":r8"> featureNS: "<a href="http://www.medford.org/">http://www.medford.org/</a>",</span><br><span dir="ltr" id=":r8"> srsName: "EPSG:900913",</span><br>
<span dir="ltr" id=":r8"> version: "1.1.0"</span><br><span dir="ltr" id=":r8"> }),</span><br><span dir="ltr" id=":r8">filter: new OpenLayers.Filter.Spatial({</span><br><span dir="ltr" id=":r8"> type: OpenLayers.Filter.Spatial.DWITHIN,</span><br>
<span dir="ltr" id=":r8"> property: "the_geom",</span><br><span dir="ltr" id=":r8"> value: point,</span><br><span dir="ltr" id=":r8"> distance : 4250</span><br><span dir="ltr" id=":r8"> })</span><br>
<span dir="ltr" id=":r8">});</span></font></b></font> <br></div><span dir="ltr" id=":r8"></span></div><span dir="ltr" id=":r8"><br>I have a doubt about what I should use in the value property of the Filter, does the variable point have to be in the same projection of the data? I think so. </span><span dir="ltr" id=":r8">Is correct </span><span dir="ltr" id=":r8">the way i did it? My feature type schools is in EPSG:2270 projection.<br>
<br></span><span dir="ltr" id=":10c"></span>But the main problem is that it returns a number of features that is different of the number of features the postgis returns when I run this query (that is equivalent to code above):<br>
<br><span dir="ltr" id=":zu"><font style="font-family: courier new,monospace; color: rgb(102, 102, 102);" size="1">SELECT Count(*) as value<br>FROM schools<br>WHERE<br> ST_DWithin(<br> the_geom,<br> ST_Transform(ST</font><font style="font-family: courier new,monospace; color: rgb(102, 102, 102);" size="1">_GeomFromText('</font><font style="font-family: courier new,monospace; color: rgb(102, 102, 102);" size="1">POINT(-122.8764 42.3263)', 4326),2270),<br>
4250<br> );</font><br><br>What do you think is my mistake?<br><br>Thanks<br></span>