Hi Jesse, containsPoint is a method of (polygon-)geometries, not of features that have this geometry. Something like this should work
// you can test this in Firebug when // you're on the page // http://openlayers.org/dev/examples/editingtoolbar.html // the point-geometry to check // in my case the feature 1 was the point I digitized var p = map.layers[1].features[1].geometry; for(var i = 0; i < map.layers[1].features.length; i++) { // check if method containsPoint exists, and if so, check f point is in the geometry if(map.layers[1].features[i].geometry.containsPoint && map.layers[1].features[i].geometry.containsPoint(p)) { alert('yes, point contained'); } else { alert('no, point not contained or containsPoint-method not defined'); } } Regards, Marc Jesse Bushkar schrieb: > I need some help with containsPoint(). I have a variable (myLoc) that > represents a given point on the map on one layer. Tthe features I'm > trying to monitor are polygons, so I think I could just use the > containsPoint function mixed with a for loop for each feature. Does > that make sense? Also, would it matter that my starting point and the > other polygons are on different layers? > > Something like: > > > var isHere; > > for (var i = 0; i < layer.features; i++) { > isHere = layer.feature[i]. > containsPoint(myLoc); > if (isHere = TRUE) { > alert('true'); > } > } > > am I way off? > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users > _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
