<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19088"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=421255316-17062011>as far as I can see from OpenLayers\Filter\Spatial.js 
is the filter type not supported</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=421255316-17062011></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>&nbsp;&nbsp;&nbsp; 
evaluate: function(feature) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var 
intersect = false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
switch(this.type) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 
OpenLayers.Filter.Spatial.BBOX:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
case 
OpenLayers.Filter.Spatial.INTERSECTS:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
if(feature.geometry) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
var geom = 
this.value;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
OpenLayers.Console.error(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
OpenLayers.i18n("filterEvaluateNotImplemented"));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return intersect;<SPAN 
class=421255316-17062011>&nbsp; //is false for case 
default</SPAN><BR>&nbsp;&nbsp;&nbsp; },<BR></FONT></DIV>
<DIV><SPAN class=421255316-17062011></SPAN><FONT face=Arial><FONT 
color=#0000ff><FONT size=2>Arnd</FONT></FONT></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT><BR>&nbsp;</DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> openlayers-users-bounces@lists.osgeo.org 
[mailto:openlayers-users-bounces@lists.osgeo.org] <B>Im Auftrag von </B>Coup 
Coup<BR><B>Gesendet:</B> Freitag, 17. Juni 2011 16:47<BR><B>An:</B> 
openlayers-users@lists.osgeo.org<BR><B>Betreff:</B> [OpenLayers-Users] Spatial 
Filter Result wrong<BR></FONT><BR></DIV>
<DIV></DIV>
<TABLE border=0 cellSpacing=0 cellPadding=0>
  <TBODY>
  <TR>
    <TD vAlign=top>I am trying to get a client-side openlayers function that 
      can determine if 2 geometries are within x miles of each other. First, I'm 
      trying to develop a prototype of said methodology using spatial filters. 
      My end result is wrong (false).&nbsp; (there are no river 
      crossings)<BR><BR>Here is the test:<BR>fishkill = new 
      OpenLayers.Geometry.Point(-73.903094, 41.534933);<BR>//(Fishkill, NY 
      12524)<BR>fishkill = fishkill.transform(new 
      OpenLayers.Projection("EPSG:4326"),new 
      OpenLayers.Projection("EPSG:900913"));<BR><BR>poughkeepsie = new 
      OpenLayers.Geometry.Point(-73.87089, 41.640904);<BR>//( Poughkeepsie, NY 
      12603)<BR>poughkeepsie = poughkeepsie.transform(new 
      OpenLayers.Projection("EPSG:4326"),new 
      OpenLayers.Projection("EPSG:900913"));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      <BR>var tolerance = 20;<BR>filter = new OpenLayers.Filter.Spatial({type: 
      OpenLayers.Filter.Spatial.DWITHIN,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      value: poughkeepsie, distance:tolerance, distanceUnits: 
      'mi'})<BR>alert('Result: ' + filter.evaluate(fishkill));<BR><BR><BR>This 
      test returns false, indicating to me that fishkill is NOT within 20 miles 
      of poughkeepsie (this is wrong, the points are actually about 9 miles 
      apart.) <BR><BR>Anyone see what I'm doing 
wrong?<BR></TD></TR></TBODY></TABLE></BODY></HTML>