Titanium Community Questions & Answer Archive

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

addroute - route only in one color?

is it possible to assign a different color for each point in a route in the addroute() function?

I.e. for displaying the altitude in a route?


— asked November 26th 2010 by Werner Bogula
  • addroute
  • color
  • iphone
  • route

1 Answer

  • Hi Werner

    You can only set a color for the line, rather than each point. However, have you tried splitting the route up into groups (defined by altitude ranges), and to add a new route with a new color for each segment in the journey (or whatever) that moves into a different range?

    Alternatively, you could use a map annotation at each point in the route, but bear in mind that there are only 3 colours available for annotations (red, green and purple).

    Hope this is useful.

    — answered November 26th 2010 by Paul Dowsett
    1 Comment
    • Hi Hal,

      thanks for the idea. If there is no better solution I will have to live with this, although it would be rather impractical.

      As altitude is a continous value it would be much better to have continous values, so that every point in a route could show a different color.

      For the annotations, its a pity they have only 3 colors?
      Why is that?
      I hope I can modify the sourcecode of the geolocation module so that I can assign more colors, i.e. 255 shades between red and green, so I will set the values as annotations.

      This method would also work for Android, that has for no understandable reason no addroute()-method.

      Thank you an keep up the good work..

      — commented November 28th 2010 by Werner Bogula
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.