[OpenLayers-Users] FeatureVector and atPoint() function way off. Why??

plen peteralen at earthlink.net
Mon Oct 13 23:12:00 EDT 2008


Hello,

I have created some polygons through the DrawFeature and saw that there is
an atPoint() for both the OpenLayers.Feature.Vector and the feature vectors
geometry property.  When I register a click event for the map, I get the
lat/long for the point clicked via:

map.events.register("click", map, function(e) { 
   var lonlat = map.getLonLatFromViewPortPx(e.xy);
   ....
}

When I use that lonlat to see if the click was on one of my features, I do
the following for each of my features:

if (feature.atPoint(lonlat)) {
  ......
}

The problem is that the statement is true even when I click well outside of
any of the features.  It typically is "true" whenever I click inside the
features, but it also is true in alot of areas outside as well.

Does anyone know why this is?  I see that there is some optional tolerance
parameters for the atPoint() function, but I dont know what those values
would be.  Is there some trick to getting this function to work properly or
is a crap shoot.

Thanks for any insight - Peter
-- 
View this message in context: http://www.nabble.com/FeatureVector-and-atPoint%28%29-function-way-off.-Why---tp19966398p19966398.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list