For those interested I ended up using the following: http://groups.google.com/group/Google-Maps-API/browse_thread/thread/224da190b393a34a
He has some code that I modified to allow me to work out the nearest line to a latLng, from this I can workout out the nearest segment obviously. On Mar 24, 9:04 pm, Doomsday <[email protected]> wrote: > Yeah nice Marcelo that is just what I needed to get started! > > It would be nice to have more simple solution but at least now know > that I can do it. > > On Mar 23, 11:34 pm, marcelo <[email protected]> wrote: > > > Check out this example:http://maps.forum.nu/gm_mouse_dist_to_line.html > > > Make a few clicks to draw line segments, then notice that, at the > > bottom of the map, distance to each individual segment is calculated > > independently. > > You could determine the nearest segment in a similar fashion. > > > -- > > Marcelo -http://maps.forum.nu > > -- > > > On Mar 22, 4:13 pm, Doomsday <[email protected]> wrote: > > > > So I have existing code that allows a user to plot a polyline. Now > > > what I would like to do is catch the mouse over the polyline event and > > > open a infowindow. > > > > All seems ok so far as I have seen that the API supports this event. > > > However in the infoWindow I'd like to show their distance along the > > > polyline relative to the start position of the polyline. So if the > > > polyline is 10kms long and they move the mouse over the polyline at > > > the halfway point then in the infoWindow it will show 5km, and as I > > > move my mouse along the polyline the infoWindow will also move > > > updating the mouses distance on the polyline from the start. > > > > Now I have been looking over the api and I don't really see a clear > > > cut way of doing this apart from some hack job. My main problem it > > > seems is that the position that the mouse is at on the polyline may > > > not have a vertex under it (ie the mouse is in the middle of a long > > > straight in the polyline between 2 points). Sure I could stop at the > > > vertex before or after the mouse position but accuracy is important. > > > > Is there anything in the api to help me with this that I am missing?? > > > > I would really appreciate some suggestions before I tackle this > > > problem. > > > > Thanks in advance > > > Joe --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
