LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generat kml (google earth html) color code from color ramp

Solved!
Go to solution

I am looking for a more efficient way to take a numeric input and generate a html color code that is compatible with Google Earth color codes.  The included example works sort of, but is slow...it seems to need a delay between writing to and reading from the color ramp.  Full codesseem to be of the form

 

oobbggrr

 

where oo is an 8-bit opacity (00-FF)

bb is an 8-bit blue code (00-FF)

gg is an 8-bit green code (00-FF)

and rr is an 8-bit red code (00-FF)

 

Any suggestions?

0 Kudos
Message 1 of 7
(7,108 Views)
I don't quite understand. You said you wanted a way to take a numeric input and generate an HTML color code. The VI you posted has three numeric inputs, plus an array of scale marker values. What's the numeric input that you're referring to that you want to change to the HTML color code, and what is the number supposed to represent?
Message Edited by smercurio_fc on 07-20-2009 05:01 PM
0 Kudos
Message 2 of 7
(7,101 Views)

Thank you for looking at this.

 

OK, to add some more detail...

 

Given an arbitrary color map or color table (in this case represented by array of scale marker values), I would like to convert a numeric input  ("Value" in my example) into a kml color code.  The other two numeric inputs in my example are simply the minimum and maximum of an array of values, used to scale the input to a number between 0 and 100.

 

A simplified version of the vi is attached.

0 Kudos
Message 3 of 7
(7,085 Views)
Solution
Accepted by topic author murphyfields
It's worse than you thought. I was playing around with your VI for a bit and I discovered that when it's used as a subVI and with the front panel closed, the result is wrong. I recoded the VI based on your second version using the Value property node and discovered that this works much more smoothly. There's no need for a delay, and it seems to return the correct values regardless of whether the front panel is open or closed. See the attached example to see what you think. A fairly "interesting" behavior of the color ramp control.
Message 4 of 7
(7,077 Views)

Thank you and Kudos!

 

Is there a more efficient way to do this that you can think of? 

 

This seemed pretty kludgey when I coded it, but could not come up with anything better.  Your method is a significant improvement, but it seems like there should be something built in to do this (must be done when labview creates intensity plots or color ramps, anyway.

 

Thanks again, and will post as solved after today.  Just curious about any other possible solutions.

 

- John

0 Kudos
Message 5 of 7
(7,073 Views)
To be honest, I was just looking at the behavior of the color ramp, and not addressing the broader question. As far as a more "efficient" way of doing it, you have a somewhat arbitrary requirement of using a numerical value that's a sort of index into some color table. Somewhere you need to define this color table. As an alternative, you could, for example, just use a color box control and convert that directly to the kml color format.
0 Kudos
Message 6 of 7
(7,036 Views)

My goal is to create an intensity plot using google earth.  Basically I have a file with longititude, latitude, and amplitude and want to create a color-coded bar graph on the surface of the earth.  I want to use LabView features as much as possible...and since they have an intensity plot already...I want to make it roughly similar.

 

I have the basics written, but the color must be a function of amplitude.  And  I need some efficient way to include the color map if I decide to change the mapping (or someone else decides to change it)

0 Kudos
Message 7 of 7
(7,029 Views)