Knowledge Base



KB10441 - Render the colors of map features based on attribute table values.

The TatukGIS Developer Kernel (DK), GIS Editor, and free GIS Viewer contain a powerful visual layer property control to enable the user to set any visual style, e.g. colors, line widths, line types, polygon fills, polygon boarders, labels, icons/symbols, bitmap images, transparencies, etc. The color coding of individual vectors in a layer based on the values (or text information) in a selected attribute field is one example of the many possibilities.

The easiest way to set up colors and other visual properties is to use the TatukGIS Viewer or Editor to do this and save the visual configuration as a TatukGIS project (*.ttkgp) file. The TatukGIS project file can then be readily opened in the DK or IS, or any custom application developed from the DK. Help with setting up a visual layer properties of a map layer is available in the on-line Editor tutorials.

Alternatively, a DK developer can associate the rendering of visual styles, such as colors, to attribute values with the use of ini files. This is done within the configuration files using code.

The procedure, using the Editor or Viewer products, to render colors based on attribute field values is:

  • Open the vector map file and double click on that layer in the Legend panel to open the visual layer properties dialog box.
  • Within that dialog box, go to the Section tab and select the attribute which contains the values to be associated with the colors.
  • Enter logical query definitions (formulas) reflecting the values contained in the fields of the selected attribute.
  • Go to the Line, Area, or Marker tab (the tab name will depend on whether the subject layer contains vector lines, polygons, or points, respectively) and set the color for each query definition (formula).
  • Click on the OK or Apply button to apply the colors to the map.  

If, for example, the ID attribute were used (to render colors based on each object's ID value), the vector with the ID number 21 would be assigned the color orange, the vector with the ID number 22 the color green, vectors with ID numbers 25 – 30 the color yellow...

The formula definitions would look like:

ID = 21
ID = 22
(ID >= 25) and (ID <= 30)
Created: September 14, 2005, Modified: September 12, 2017