Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

map annotation to screen coordinates

is there anyway to know where in the screen a map annotation is?
I am trying to replace the user location icon with my own but I need to know where it is on the screen.

or how to know where a lat,long position is on the screen.

thanks in advance

— asked October 14th 2010 by jordi martinez
  • annotation
  • geolocation
  • iphone
  • map

1 Answer

  • Accepted Answer

    Why can't you just add an annotation with your custom image like this?

      currentLocation = Ti.Map.createAnnotation({
        latitude: currentLat,
        longitude: currentLng,
        title: 'You are here',
        image: 'images/icon-gps-location.png',  // This is your custom image

    The problem with mapping the lat/lng to screen coordinates is you have to watch for every regionchange event and orientationchange event so you can handle the device being rotated or the map moving. It's easier to drop an annotation on the map and let the mapview do the work.

    You can find the visible area of the map by looking at mapview.region. This will have the center of the map and the delta in degrees.

    — answered October 14th 2010 by John McKnight
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.