Let me see if I'm understanding you right... The user clicks on a point on the map and you want to know between which two points on a polyline the click occurred?
As far as I know there is no direct method to get such a value. I've done something similar with a polygon tool I'm working on, though. Check out: http://arclyte.netdojo.com/geo/modal_map.html You start in "Draw Mode"... add points to create a polygon. Then click the "Draw Mode" button at the top to go into "Edit Mode". Now any time you click on the map it will insert a midpoint between the closest two points to the click event. I do it by looping over the markers array and comparing the distance between each point and the clicked point. The shortest two distances will be the segment you're looking for. You could probably adapt this to your situation, maybe adding a max distance from the line so it ignores clicks clear across the map from your polyline... - Jim On Nov 17, 7:30 pm, ziligy <[email protected]> wrote: > Is there a way to tell on which polyline segment a click event was > triggered. I'm using v3. I can detect the map location, but I want to > know between which two array elements the event was triggered. -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
