Hi Phil, that might be a good way to solve this as well. I'll give it a go!
Thanks, Alex. Date: Wed, 11 Aug 2010 10:07:01 +1200 From: Phil Scadden <p.scad...@gns.cri.nz> Subject: Re: [OpenLayers-Users] clickTolerance on selectFeature? To: users@openlayers.org Message-ID: <4c61cd85.2010...@gns.cri.nz> Content-Type: text/plain; charset="ISO-8859-1" > I'm mainly dealing with polylines, but if that is the only way, then > so be it. How can I perform buffer calculations? > Buffering every line in your display to see if selected is very intensive. If you are struggling with accurate selection of lines, can I suggest an alternative approach? If you use a highlight only hoverselect control as well as a select control, then you can move mouse till target is highlighted, then click to select. Code like: HoverSelectControl = new OpenLayers.Control. SelectFeature(myLayers,{hover:true, highlightOnly: true, renderIntent: "temporary" }); SelectControl = new OpenLayers.Control.SelectFeature(myLayers,{clickout: true}); SelectControl.events.on({ "featurehighlighted": onFeatureSelect, "featureunhighlighted": onFeatureUnselect }); map.addControl(HoverSelectControl); map.addControl(SelectControl); HoverSelectControl.activate(); SelectControl.activate(); The order you add controls is important - hover first. I find that this feels quite natural. If the layers cans handle wfs, you might be better to create a wfsprotocol object and do a spatial intersects query, passing a rectangle around the click point and then processing the return.
_______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users