[OpenLayers-Users] Selecting LineString features at any point on the line?

Nick Whitelegg nick at hogweed.org
Thu Apr 5 04:11:26 EDT 2007


On Thursday 05 Apr 2007 00:37, you wrote:
> On Thu, Apr 05, 2007 at 12:23:28AM +0100, Nick Whitelegg wrote:
> > Experimenting with the new vector stuff. What would be good is to be able
> > to select a LineStriing by clicking on any part of the LineString - not
> > just the points. Is this possible?
>
> As far as I can tell, that is currently the case. You're using trunk and
> don't see it that way?
>
> Regards,

Yes - see 

http://www.free-map.org.uk/vector/

This fetches OpenStreetMap data and renders it in a vector layer. You can only 
click on the LineStrings at the points.

Using http://www.openlayers.org/dev/lib/OpenLayers.js.

Code to setup the control:

 controls = {
                select: new OpenLayers.Control.SelectFeature
                    (vectorLayer,{callbacks:		                               
{'up':selectUp,'over':selectOver}})
                        };
 for(var key in controls)
 {
      map.addControl(controls[key]);
 }
 controls.select.activate();

Nick



More information about the Users mailing list