FGDC Color Matcher by moendopi


This little tool isn't much to get excited about. But it gets the jobs done.

I made this when I started the job I do now to make things easier when digitizing geologic maps. A lot of old maps have no GIS data associated with them, and even ones that do rarely have the FGDC values, RGB color values, or CMYK values. Sometimes they might have a layer file with them, but rarely. And even if they do have layer file, that's not terribly useful.

I'm partly color blind, well, color deficient, so guessing at the color isn't something I really want to do. So, I wrote this little program to convert a CMY(K) value for a color vlaue to an FGDC color value that can be used in the Symbology field of a vector layer / feature class for a GeMS compliant geologic map database.

(I still have to rely on a graphics program with a little dropper tool to slurp up the CMYK value)

**The K is in parentheses because the FGDC color codes have 0 for all the black, K, values. Thus the K value is never asked for. No FGDC code has any black in it. This can be an issue when converting from RGB values which can have the black built in. If you have RGB values, their CMYK values (when converted) may be lighter. We use the CMYK values because, originally, these were supposed to be for print maps, not exclusively for online/monitor display. Even though the print shop is basically dead, we stuck with CMYK values. Oh well.

For now these will just be here as raw text Python/Perl code. Eventually I plan to make these a web utility so they can be used directly in the browser, but I haven't gotten there yet. I'm still learning how Perl CGI's work and how PHP works.

Python FGDC Color Matcher


This just runs in the command line,so just run `python color-matcher.py` or whatever you decide to name it.
It will prompt the user for the C:, M:, and Y: color values and then convert them into an FGDC color code, which it will print out on the screen. It's pretty simple.

color-matcher.py (txt format)

color_code_dict.py (txt format)

------------------------------

Perl FGDC Color Matcher


For shiggles and in an effort to learn Perl I rewrote this, pretty much as a 1:1 from Python to Perl. It functions the same and have the same output.

Eventually, and I've wanted to do it for a while and never gotten around to it, I want to add:
- functionality to take in a list of CMYK values and output a list of FGDC code values
- take in a CSV of CMYK values and output a CSV of the CMYK values
- take in the map unit in addition to the user in addition to the C, M, Y values, save that map unit with the FGDC code, and when the user is done, output a CSV that looks something like this:

Ccs 274
Cms 374

It's simple, but that's all I need. I often just make the CSV myself and that's all it really is. Two columns, one for the map unit, one for the FGDC color code.

color-matcher.pl

color_code_dict.pl