GPX individual Color in xml?

1,511 views
Skip to first unread message

Larry Ly

unread,
Dec 31, 2015, 2:10:31 PM12/31/15
to Osmand
Is there a way I can set the color of the GPX tracks in xml? 

I am looking at the code directly (Android) and there are some places in there where it gets the color, but I am not sure from the file or from some attr in android resource file xml.

I have also read that you can manually change the color of the tracks in the render in its xml, but I would like to have different tracks with their own colors for when they are all displayed on the screen, you can tell which tracks belongs to who.

Is there an easy way to do this? Or will I have to modify the code myself to support color in the xml?

Thanks!

David

unread,
Jan 6, 2016, 5:27:01 PM1/6/16
to Osmand
You can manualy set the color "code" in the gpx files and the osmand renderer will display the chosen color, but that is not a verry userfriendly solution.

It would be much nicer to be able to set the colors in the same/comparable way as the colors for the diferent sets of favourites.

And while they are at it also include a free (hex-coded) choice of colors (for both).
Or at least ad black, white and 2 or three grays.

David

Larry Ly

unread,
Jan 7, 2016, 1:45:55 PM1/7/16
to Osmand
how do you manually set the color code in the gpx file? I don't mind implementing something to add custom colors to the gpx if need be.

Harry van der Wolf

unread,
Jan 7, 2016, 4:04:27 PM1/7/16
to osmand
The colors are taken from the render files. The default ones are built into OsmAnd but can be found here: https://github.com/osmandapp/OsmAnd-resources/tree/master/rendering_styles
As a small hint: search for gpx in the default.render.xml

Search through the OsmAnd Google groups. There are many examples on how to make a derived render file for only your modifications and this specific questions with answers has also passed. See for example https://groups.google.com/forum/#!topic/osmand/B15t5obhars in the section around 03-08-2015


Harry

--
You received this message because you are subscribed to the Google Groups "Osmand" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David

unread,
Jan 7, 2016, 5:40:01 PM1/7/16
to Osmand
What I did is to edit the GPX files and change or ad the <color> "code" in the gpx file in the hex colorcode I want that specific gpx file to display
The folowing example is the start of a gpx file of the emaus thrift stores in france which I gave the   <color>#ffff00</color>  "code" which I think is bright yellow.
In my case I always use gpx files with waypoints but I expect it will also work with tracks.

This does work, but it would be much-much-much more convienient when this could be done in OsmAnd.
If my pleas to the OsmAnd-powers-that-be do not help I would also be interested to know if anybody knows of a simple app that could change all the color codes in a given gpx file into the color of my choice

David


Start of an example gpx file with color codes:
===========================
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
  <metadata><!--

  --><link href="http://turboccc.wikispaces.com"></link>
    <time>2014-09-04T14:11:06Z</time>
  </metadata>

  <wpt lat="50.1040119" lon="1.8367092">
    <name>Boutique DING FRING</name>
    <cmt> </cmt>
    <desc>66 rue du Marechal Foch - 80100 - ABBEVILLE</desc>
    <extensions>
      <gpxx:WaypointExtension>
      </gpxx:WaypointExtension>
    <color>#ffff00</color>
</extensions>
  </wpt>

  <wpt lat="44.2065594" lon="0.6422672">
    <name>Communaute Emmaus</name>
    <cmt> </cmt>
    <desc>5 rue du Jourdain - 47000 - AGEN</desc>
    <extensions>
      <gpxx:WaypointExtension>
      </gpxx:WaypointExtension>
    <color>#ffff00</color>
</extensions>
  </wpt>

  <wpt lat="50.6391089" lon="2.3940325">
    <name>Boutique DING FRING</name>
    <cmt> </cmt>
    <desc>1 Place Notre Dame - 62120 - AIRE SUR LA LYS</desc>
    <extensions>
      <gpxx:WaypointExtension>
      </gpxx:WaypointExtension>
    <color>#ffff00</color>
</extensions>
  </wpt>
==========================================

Larry Ly

unread,
Jan 11, 2016, 1:34:02 PM1/11/16
to Osmand
thanks for the detail instructions. I guess this is already done in the code. i.e. using the color in GPX file. I will give this a try and see if it works or not. From what you are saying, I don't think this should be that much difficult to add another menu in the GPX menu to allow users to change color provided you supply a simple way for users to edit the track file. 

I am not promising anything, but if I can correctly implement this, I will definitely release the modified code to community.

David

unread,
Jan 12, 2016, 2:27:15 PM1/12/16
to Osmand
Please do,

I am sure that more people than just me use a lot of different gpx and or favorite categories. And color is the only way to keep that usable without having to "test-touch" many many individual sitemarkers.

David

Reply all
Reply to author
Forward
0 new messages