Titanium Community Questions & Answer Archive

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

custom images for Annotation pin?

Hi,

is it possible to use a custom image as marker on the Titanium.Map.view? (or is there a nice ducktape-code-snippet?) If not: Would love to see this within the next version! :)

thank you,
flo

— asked April 27th 2010 by Florian Bergmann
  • image
  • map
  • marker
  • pins
  • view
0 Comments

4 Answers

  • For iPhone, you can use the 'image' property to replace the pin, but it needs to be a local image.

    — answered October 7th 2010 by Charles Davison
    permalink
    0 Comments
  • Hi, I dun think you can customize it. If you find a way, do let us know :-)

    — answered April 28th 2010 by Peter Lum
    permalink
    0 Comments
  • There seems to be an example in the KitchenSink?

    var atlantaParams = {
            latitude:33.74511,
            longitude:-84.38993,
            title:"Atlanta, GA",
            subtitle:'Atlanta Braves Stadium',
            animate:true,
            leftButton:'../images/atlanta.jpg',
            rightButton: Titanium.UI.iPhone.SystemButton.DISCLOSURE,
            myid:3 // CUSTOM ATTRIBUTE THAT IS PASSED INTO EVENT OBJECTS
        };
    
    if (!isAndroid) {
        atlantaParams.pincolor = Titanium.Map.ANNOTATION_PURPLE;
    } else {
        atlantaParams.pinImage = "../images/map-pin.png";
    }
    var atlanta = Titanium.Map.createAnnotation(atlantaParams);
    
    — answered May 19th 2010 by Mattias Svedhem
    permalink
    1 Comment
    • that only works in android. for the iphone, you can only have the normal 'pins' with the colors on a map, as the marker.

      rocksteady,
      danno~

      — commented June 24th 2010 by danno watts
  • This is now possible in both Android and iOS.

    Using the Annotation.image property, you can specify an image path to view instead of the pin.

    var atlantaParams = {
            latitude:33.74511,
            longitude:-84.38993,
            title:"Atlanta, GA",
            subtitle:'Atlanta Braves Stadium',
            animate:true,
            image: 'images/cityIcon.png',
            leftButton:'../images/atlanta.jpg',
            rightButton: Titanium.UI.iPhone.SystemButton.DISCLOSURE,
            myid:3 
        };
    
    var atlanta = Titanium.Map.createAnnotation(atlantaParams);
    
    — answered November 27th 2011 by Chris Dunstall
    permalink
    1 Comment
    • And what if I would like to have a run time made pin? I mean a Pin that can change every time the user open the map because it's generated on dynamic information.
      I'm trying to obtain this effect using a view that I eventually trasform in an image thanks to the method "toImage()" but it dosn't work.
      I do tou suggest?

      — commented August 13th 2013 by Luca Marzi
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.