Topographic & Bathymetry map using image sampler(hueevaluation)

Evening All,

Recently, I’ve been practicing my grasshopper skills on creating topographic maps. I’ve been able to model topography’s thanks to SRTM files (black and white).

I’ve now started looking into modeling topography and bathymetry in the same file with colour this time. The subtility is that I would like to control the remaping of the bathymetry independantly from the topography.

My first instinct was to try and use the hue values in order to dispatch the two values, which hasn’t worked. Produces the same amount of values for smaller than 0.5 and larger than 0.5. I then found a post from a few years back:

I’ve got a feeling that this might also be a possibility to solve my issue but I don’t seem to understand how the script works unfortunately.
Could someone be kind enough to help me out with this please?

Cheers,
Tom

RemappointsAccordingToColour(SplitInTwo).3dm (6.6 MB)
RemappointsAccordingToColour(SplitInTwo).gh (9.0 MB)

So no one has an idea how to go about splitting into two different remaps depending on colour values?

Please let me know if the jpeg has properly been embedded into the definition.

If you have an image that uses a gradient to represents a grid of two-dimensional values, and you have the gradient it uses, then you can do the following to convert your colours back into numbers:

  • Evaluate your gradient at a lot of locations (100 say, or even 1000 if you have that much detail).
  • Convert this list of colours into a list of points. You can just plug colours directly into a point parameter, or you can convert RGB or HSV into XYZ yourself.
  • You now have a string of points (hopefully a rather smooth one, but that depends on the continuity of your gradient) that sort of looks like a curve if you squint. This curve represents your gradient in RGB space.
  • Now sample your image in as many locations as you want, this gives you a list of one colour per location.
  • Convert these colours into points as well (using the same method as before).
  • Use the Closest Point component to find which point on your gradient spline is closest to your sampled colour-point. Index=0 means start of the gradient. Index=99 (assuming one-hundred points) means end of the gradient. In between means along the gradient. Map your point index to the numeric domain of your gradient and you have your numeric values.

It’s pretty involved, and unless your gradient is very accurate it will have plenty of noise, but I think it’s the only way to reverse engineer an image like this als je begrijpt wat ik bedoel.

Hi,
Not sure this is of some help to you, anyway you can convert the hue values as a height field data using mesh.
But your hue values are not correspond to the height values of actual topography if the red part is the highest portion of the topo…

TopoByColourHue_re.gh (16.9 KB)

Right off the bat, thank you to both of you for having a look at this definition with me.

I’ve started exploring the avenue you mentioned @DavidRutten David, without much success for the moment. The problem is that I don’t have the gradient that goes with the original map. What I have tried doing is guessing what the extreme colors values are and evaluating the gradient of points between them (green to red and green to dark blue). I’ve got to be honest I’m kind of stuck at the first two steps that you talked about at the moment but I’m confident a bit more time on it will crack it.

The definition you shared @HS_Kim is pretty good. A few of the components you used I have never seen before though. The only thing I can notice is that the seabed is pretty flat for the moment. Perhaps with a few tweaks, I can get it to display more contrast.

Your point about the hue colors not corresponding to height values is a good point. I’m currently studying Bangladesh. I have come to realize that the country is extremely flat. I was keen to show more detail of it as I am creating sections of the country. The trouble comes from the fact that the SRTM data I could find for Bangladesh is 30 arc-second elevation which is evaluating the topo at 1 km increments. This leads to black and white topo images being just one unified grey colours for the Bangladesh basin. This is the only map where I could get a bit of variation in the colors.

I’ll share my progress when I have eventually got somewhere with this…