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)
Here is the test:
fishkill = new OpenLayers.Geometry.Point(-73.903094, 41.534933);
//(Fishkill, NY 12524)
fishkill = fishkill.transform(new OpenLayers.Projection("EPSG:4326"),new
OpenLayers.Projection("EPSG:900913"));
poughkeepsie = new OpenLayers.Geometry.Point(-73.87089, 41.640904);
//( Poughkeepsie, NY 12603)
poughkeepsie = poughkeepsie.transform(new
OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));
var tolerance = 20;
filter = new OpenLayers.Filter.Spatial({type: OpenLayers.Filter.Spatial.DWITHIN,
value: poughkeepsie, distance:tolerance, distanceUnits:
'mi'})
alert('Result: ' + filter.evaluate(fishkill));
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.)
Anyone see what I'm doing wrong?
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users