Opened 2 weeks ago
Last modified 9 days ago
#24323 new enhancement
Inaccurate color description in GPX track drawing dialog
Reported by: | Owned by: | team | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Core | Version: | |
Keywords: | HDOP GPX colouring | Cc: |
Description
- Open any GPX track with HDOP information
- Right click the layer and select Customize track drawing
- Select the Dilution of Precision option. Notice that it says "red = high, green = low"
- Press OK
- Line contains various shades of blue and purple. I guess that's extra high and blue was put in the middle or something??
I tried searching dop and dilution in the help pages. The system searched long and hard, but the results were no good. With that out of the way, it was time to open up the real documentation: source code!
I must say, the project structure is surprisingly straightforward and it was easy to find the relevant file in the tree without ever having seen JOSM code before
57 import org.openstreetmap.josm.tools.ColorScale; .. 249 hdopScale = ColorScale.createHSBScale(256).makeReversed().addTitle(tr("HDOP")); .. 671 if (colored == ColorMode.HDOP) { 672 color = hdopScale.getColor((Number) trkPnt.get(GpxConstants.PT_HDOP)); 673 }
Following the reference to what HSBScale(256) does:
67 /** 68 * Gets a HSB color range. 69 * @param count The number of colors the scale should have 70 * @return The scale 71 */ 72 public static ColorScale createHSBScale(int count) { 73 ColorScale sc = new ColorScale(); 74 sc.colors = new Color[count]; 75 for (int i = 0; i < count; i++) { 76 sc.colors[i] = Color.getHSBColor(i / 300.0f, 1, 1); 77 } 78 sc.setRange(0, 255); 79 sc.addBounds(); 80 return sc; 81 }
Looking around the web for what an HSB is, this seems to be a nice page: https://coolors.co/ff00ff. Click on "Picker" on the bottom right and select HSB. The H is in degrees and matches the usual RGB thing, but if I'm seeing it right, JOSM only uses until 300°? So the last color on the scale is the purple that I linked; degrees 301--359 with further shades of purple, pink, and red are not used, I guess to avoid confusion with red being at the low end? Though purple is closer to red than blue, so if confusion is to be avoided I'd stop at blue
So that answers the question: the scale isn't red to green, it's red to blue in RGB order
To resolve this discrepancy,
A: the scale could be changed to actually be R through G as stated, or
B: the text could be adjusted to be something like "Dilution of Position (HDOP: red=high, green=middle, blue=low)". The "if available" information (as in the original/current string) is sorta obvious, but also already contained in the tooltip. Also, by putting spaces in this way, it groups the items that belong together, making it easier on the eyes to read
What should we do?
For myself, I guess I'd prefer option B because, while I can tell shades of orange and yellow apart reasonably afaik, a larger range of colors should highlight nuances better and accommodate more people. The downside is that all translations will have to be re-done for this entry.
(Another enhancement might relate to the "GPX fix value" option. I have no clue what that means, the tooltip doesn't help, I have no hope that the help pages will find anything useful with any of those three keywords, and the source code doesn't reveal that it's an alias for anything. A web search doesn't turn anything up besides the generic GNSS meaning of "fix" as in "a position was computed", but based on another result I would hazard a guess that it might have to do with being synced up to an RTK thingy? If whoever works on this ticket knows the answer, maybe they could disambiguate that menu entry's text as well.)
About the "GPX fix value". These values are extracted from the gpx/nmea files
For a gpx file, fix values are:
For a nmea file, fix values are:
You can see these values with the top right color bar, when you activate the GNSS layer.