Im trying to perform routing with openlayers, geoserver and mysql. In order to get the start and end points, I need to be able to get a feature of the node layer (which has point features) that lies closest to an arbitrary point I click on the map. Does openlayers provide any functionality for this. If not, kindly suggest any alternative methods for achieving this.
With a bit of comparison you can:
(note, I use underscore.js _.min function, you could of course do this with a foor loop etc, the clue is to loop the features and get the one with the shortest distanceTo the clicked point)
Yes, OpenLayers has this functionality. Its called SelectFeature Control. see docs here.
you should check how the following examples work(uses: OpenLayers.Control.SelectFeature).
You can get full list of examples here and apply keywords filter for