<!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> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
evaluate: function(feature) {<BR> var
intersect = false;<BR>
switch(this.type)
{<BR> case
OpenLayers.Filter.Spatial.BBOX:<BR>
case
OpenLayers.Filter.Spatial.INTERSECTS:<BR>
if(feature.geometry)
{<BR>
var geom =
this.value;<BR>
if(this.value.CLASS_NAME == "OpenLayers.Bounds")
{<BR>
geom =
this.value.toGeometry();<BR>
}<BR>
if(feature.geometry.intersects(geom))
{<BR>
intersect =
true;<BR>
}<BR>
}<BR>
break;<BR>
default:<BR>
OpenLayers.Console.error(<BR>
OpenLayers.i18n("filterEvaluateNotImplemented"));<BR>
break;<BR>
}<BR> return intersect;<SPAN
class=421255316-17062011> //is false for case
default</SPAN><BR> },<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> </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). (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>
<BR>var tolerance = 20;<BR>filter = new OpenLayers.Filter.Spatial({type:
OpenLayers.Filter.Spatial.DWITHIN,<BR>
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>