color by level Re: Color by...

Olly Betts olly at survex.com
Thu Feb 20 00:31:11 GMT 2025


On Sat, Feb 15, 2025 at 02:15:38PM +0000, Warren Family wrote:
> I don't really follow what 'color by survey' is doing -- I didn't find it
> described in the documentation but maybe I'm looking in the wrong place.  I
> did some experiments on the Dow Prov survey data and I'm getting confusing
> results (link to .3d file below if you want to try).

It assigns an arbitrary colour to each survey name (implemented by
calculating a numeric hash from the survey name and converting the hash
to a colour in HSV-space with the full range of hue, saturation >= 50%
and value 90%).

> Loading the full .3d file and displaying it in aven, colored by survey,
> seems to end up with the whole of Providence Pot (one level down) the same
> color although it contains several sublevels, but other parts such as the
> various sublevels of Dow Cave which are two levels down get colored
> differently.  Then for the latter, whereas most of the sublevels under
> choke2 in Dow (two levels down) are colored differently, the levels labelled
> 'albert1', 'albert2' and 'albert3' appear to have the same color.  I don't
> think this is by chance as it appears to be the same if I just load the .3d
> file for Dow Cave, thus removing the top level.  On the other hand if I just
> load the Providence Pot .3d file then the different sublevels do get colored
> differently
> 
> https://github.com/patrickbwarren/qgis3-survex-import/blob/master/DowProv/DowProv.3d

The chosen colours are actually different, just some are not very
different - here's a list of the current hex triplets, internal hash
value, and survey name:

    #8f6fe6 0x04b6 dowbergill2.dgp6
    #916fe6 0x04b7 dowbergill2.dgp7
    #876ce6 0x07b4 dowcave.choke2.roofchambers
    #e66cc2 0x07e2 dowcave.dow1
    #e66cbf 0x07e3 dowcave.dow2
    #e66cbc 0x07e4 dowcave.dow3
    #77e660 0x154e dowbergill1.dgp1
    #74e660 0x154f dowbergill1.dgp2
    #71e660 0x1550 dowbergill1.dgp3
    #6de660 0x1551 dowbergill1.dgp4
    #6ae660 0x1552 dowbergill1.dgp5
    #e67f5f 0x160a dowcave.choke2.cellar
    #e65ba9 0x1be8 dowcave.choke2.wetway
    #e159e6 0x1dd4 dowcave.rattle1
    #e459e6 0x1dd5 dowcave.rattle2
    #e659e3 0x1dd6 dowcave.rattle3
    #e659e0 0x1dd7 dowcave.rattle4
    #54e664 0x225a dowcave.bridge
    #d7e653 0x232f dowcave.hobsons
    #e6634a 0x2e07 dowcave.depot
    #e149e6 0x2fd4 providencepot.ppot1
    #e449e6 0x2fd5 providencepot.ppot2
    #e649e3 0x2fd6 providencepot.ppot3
    #e649df 0x2fd7 providencepot.ppot4
    #e649d8 0x2fd9 providencepot.ppot6
    #e67747 0x310d dowcave.tube
    #e64694 0x32eb dowcave.dripstone
    #e6424e 0x36fd dowcave.roofgardens
    #e6603c 0x3d09 dowbergill2.dgp8a
    #e6643c 0x3d0a dowbergill2.dgp8b
    #a8e639 0x403a dowcave.choke2.albert1
    #a4e639 0x403b dowcave.choke2.albert2
    #a0e639 0x403c dowcave.choke2.albert3
    #e62a9c 0x51e6 dowcave.stemple1
    #e62a98 0x51e7 dowcave.stemple2
    #e62b22 0x5a02 dowcave.choke2.diga
    #e63022 0x5a03 dowcave.choke2.digb
    #16e667 0x6866 dowcave.dribblemine
    #e6ce0e 0x7026 dowcave.clogsway
    #0b28e6 0x74a5 dowcave.choke2.wetblackrift
    #d404e6 0x7bd2 dowcave.glooploop

E.g. providencepot.ppot1 and providencepot.ppot2 are different colours,
but only by 3/256ths of the amount of red, which looks similar enough
to appear to be the same colour in this context.

Eric C. Landgraf actually also spotted this a while back and
experimented with trying to mix the bits in the hash value but we
didn't come up with a result that seemed great and this was only in
chat so unfortunately it got forgotten before it was resolved (moral of
the story: open a ticket for an issue so it doesn't get forgotten).

Looking at it again, the essentially problem is we want a change to the
final character to make a big difference to the hash value (because
providencepot.ppot1 and providencepot.ppot2 are likely to be close to
each other and probably connected).  The simple answer is to calculate
the hash feeding in characters in reverse string order.  It's unlikely
to be a problem that a difference in the initial character will then
give similar colours (it'd mean hypothetical surveys barpot.entrance and
carpot.entrance in the Gaping Gill area will get similar colours, but
even for this situation that's not really a problem).

I've pushed a change to do that.  Your example now gets these colours:

    #6ee642 0x364a dowbergill1.dgp1
    #06cbe6 0x7985 dowbergill1.dgp2
    #913de6 0x3cc0 dowbergill1.dgp3
    #e6011c 0x7ffb dowbergill1.dgp4
    #b7e637 0x4336 dowbergill1.dgp5
    #996de6 0x06ba dowbergill2.dgp6
    #e63160 0x49f5 dowbergill2.dgp7
    #d011e6 0x6dd1 dowbergill2.dgp8a
    #e68742 0x3612 dowbergill2.dgp8b
    #e69948 0x3016 dowcave.bridge
    #41cee6 0x3786 dowcave.choke2.albert1
    #252ce6 0x57a9 dowcave.choke2.albert2
    #b508e6 0x77cc dowcave.choke2.albert3
    #e6c64c 0x2b22 dowcave.choke2.cellar
    #e6160c 0x7302 dowcave.choke2.diga
    #4ae699 0x2e6b dowcave.choke2.digb
    #228ae6 0x5a94 dowcave.choke2.roofchambers
    #e6331c 0x6105 dowcave.choke2.wetblackrift
    #34a3e6 0x4690 dowcave.choke2.wetway
    #9ae614 0x6a3a dowcave.clogsway
    #e65aac 0x1ce7 dowcave.depot
    #9f20e6 0x5cc6 dowcave.dow1
    #d864e6 0x11d1 dowcave.dow2
    #e634ca 0x46dc dowcave.dow3
    #e66ecd 0x05de dowcave.dribblemine
    #e4e62d 0x4e2b dowcave.dripstone
    #738ae6 0x00a2 dowcave.glooploop
    #4e5be6 0x29a7 dowcave.hobsons
    #b8e616 0x6734 dowcave.rattle1
    #07a2e6 0x788d dowcave.rattle2
    #e66bb6 0x09e6 dowcave.rattle3
    #a3e65b 0x1b3f dowcave.rattle4
    #69a8e6 0x0b95 dowcave.roofgardens
    #627ce6 0x13a2 dowcave.stemple1
    #e626c3 0x56dd dowcave.stemple2
    #5ccfe6 0x1987 dowcave.tube
    #e268e6 0x0cd4 providencepot.ppot1
    #98e632 0x483d providencepot.ppot2
    #707de6 0x03a6 providencepot.ppot3
    #e6763a 0x3f0f providencepot.ppot4
    #e643b9 0x35e1 providencepot.ppot6

> Am I right that it's only the *begin and *end hierarchy that can be inferred
> from the .3d file, not the *include's and definitely not the directory
> structure ...  (I'm not proposing to change this BTW!).  So 'survey
> structure' means the *begin..*end hierarchy as displayed on the left-hand
> side of the GUI in aven, and 'level' refers to the level within that.

The *include structure (and any directory structure) is almost entirely
ignored by Survex.  About the only thing is that cavern requires each
corresponding *begin and *end pair to be in the same file (because not
doing that seems a bad idea and checking for it catches when it happens
by accident (typically because of failing to add/remove *end when *begin
is added/removed).
 
> At the moment in aven there is an option to hide or show levels by
> right-clicking on the labels shown in the cave structure on the left-hand
> side in the GUI.  Perhaps it could be relatively easy to allow the user to
> right-click on a label and color that + all sublevels to the _same_ color.
> This could be a random color or perhaps a short list of options (eg white,
> red, orange, yellow, green, blue, grey, random).

There are standard colour picker controls so no need to restrict the
list.  Just seed the picker with a suitable default palette.
 
> If you wanted to highlight a particular part of a cave, you could then
> right-click on the corresponding label in the data structure and set the
> color of that subsection.

Yes (and that's pretty much what I described in a very recent message).
Sadly describing a new feature is typically much easier than
implementing it.  I'll get to it at some point if nobody else provides
a patch first.

Cheers,
    Olly



More information about the Survex mailing list