Hi Andrew, Thanks for your suggestions!, i used the second suggestion you gave me, for the distance calculation i use the Google Maps Api.
Willian On Dec 28, 3:05 pm, Andrew Leach <[email protected]> wrote: > On Dec 28, 10:44 am, Will <[email protected]> wrote: > > > Hi, > > > I'd like to know how i can determine between which markers the user > > clicked on the polygon. so if i have a polygon A ---- B ----- C and > > the user clicks on the line between B and C, now the polygon event > > gives me a GLatLng but how can figure out that the Glatlng is between > > B and C? > > There are at least three methods; but which you choose depends on how > you are drawing your line. Let's call the click point Q. > > You could use a straight-line graph (y=mx+c), calculate the straight > line connecting B and C and then find whether point Q lies on that > line. That will be reasonably accurate for short distances. You could > also do this in pixels if B and C are both on the map: if Q is on the > line BC as drawn in pixels, it will get the result which matches the > map shown. > > Or you could use the formulae > athttp://www.movable-type.co.uk/scripts/latlong.html > -- find the bearing of point C from B. Then find the bearing of point > Q from B. If the bearings are the same, Q lies on the line BC. Because > this method uses great circles drawn on a sphere, it will look right > if you use geodesic lines, but may not match the map if you use > straight lines. > > Andrew -- 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.
