Well you are on the right track. What you'll want to do is create a custom overlay: http://code.google.com/apis/maps/documentation/javascript/overlays.html#SubClassing
In your overlay's draw method, you can use fromLatLngToDivPixel and fromDivPixelToLatLng methods to translate between these. Chad Killingsworth On Sep 25, 3:28 am, "[email protected]" <[email protected]> wrote: > Hi, > > I want to create a compass from a polyline, which shows a certain > bearing on the map, i.e. 126 degrees. > > My original approach was to try and determine pixel positions on the > maps DIV, translate them into coordinates, and display accordingly. > But that failed kind of spectacularly from not understanding how the > Projections really work. > I got it working using coordinates for calculation, but it's kind of a > problem to determine the ideal compass needle length in degrees, so > I'm still eyeing this pixel conversion. > I guess my major problem was to understand, how the world coordinates > handed back from the Projection functions relate to on-screen-pixels, > and how to convert to and from them. I read all the tutorial about it, > but it didnt really make too much sense to me. Anyone got a > recommendation on a page to use for reading up about this, or some > very down-to-earth demo code lines explained in plain language? > > Thanks, > Marco -- 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.
