User Tools

Site Tools


TGIS_Classification class

DK11 for .NET | TatukGIS.NDK.TGIS_Classification | Classes | Constructors | Methods | Properties

Class that allows performing advanced data classification in process of creating thematic/choropleth maps.

Available also on: Delphi | Java | ActiveX.


// C#
public class TGIS_Classification : TGIS_Object
' VisualBasic
Public Class TGIS_Classification
  Inherits TGIS_Object
End Class
// Oxygene
  TGIS_Classification = public class( TGIS_Object )


→ TGIS_Object


Inherited Overrides Protected
Name Visibility Description
TGIS_Classification() public Create an object.


Inherited Overrides Protected
Name Visibility Description
Classify public Perform the classification.
Classify(TGIS_ParamsList) public Perform the classification.
MustCalculateStatistics public If True, statistics from layer assigned to classification need to be calculated, False otherwise.


Inherited Protected
Name Visibility Description
ClassBreaks public Determined class breaks.
ClassIdField public If not empty, the attribute field of the specified name will be populated with the class id values.
ColorRamp public The color ramp used to generate class breaks colors.
EndColor public Ending color for generating Params sections.
EndSize public Ending size or width for generating Params section; default is black.
Field public Numerical field from which values will be used in classification.
Interval public Class interval size; default is 1.
Layer public Layer assigned to object.
Method public Classification method; EqualInterval by default.
NumClasses public Number of classes; default is 5; max is 20.
RenderType public Visual property which will be affected during classification.
ShowLegend public If True, features will be shown in legend component; default is True.
StartColor public Starting color for generating Params section.
StartSize public Starting size or width for generating Params section; default is white.


This class can be used for data classification in process of creating thematic maps.

The main purpose of data classification is to group large number of observation into classes according to classification method and it's parameters (NumClasses or Interval).

The layer's attributes used in classification must have numerical values that are real or integer type. Name of the attribute field is specified in Field property.

Generated class breaks are stored in ClassBreaks indexed property. Furthermore, information about belonging to classes for each observation can be written in attribute field provided in ClassIdField.

StartColor, StartSize, EndColor and EndSize properties limit the range of generated visual properties - color ramp or size/width - depends on defined RenderType.

TGIS_ClassificationMethod contains list of available classification methods commonly used by GIS specialists:

  • DefinedInterval,
  • EqualInterval,
  • GeometricalInterval,
  • NaturalBreaks,
  • Quantile,
  • StandardDeviation,

and less frequent but very useful:

  • KMeans,
  • KMeansSpatial,
  • Quartile.

Data classification process can affect different visual layer's properties included in TGIS_ClassificationRenderBy enum:

  • Color,
  • Size,
  • OutlineWidth,
  • OutlineColor.




// while 'lyr' is opened layer with added empty 'CLASS_ID' field
classifier = new TGIS_Classification( lyr );

// select one of available classification methods
classifier.Method = TGIS_ClassificationMethod.NaturalBreaks;

// specify number of classes
classifier.NumClasses = 5;

// specify attribute field with numerical values
classifier.Field = 'POPULATION';

// select visual property to be affected
classifier.RenderType = TGIS_ClassificationRenderBy.Color;

// write class ids to existing layer's field
classifier.ClassIdField = 'CLASS_ID';

// check if layer's statistics require recalculation
if classifier.MustCalculateStatistics then
  lyr.Statistics.Calculate ;

// run classification process, visual properties will be applied automatically
classifier.Classify ;

// check generated class breaks values
// class breaks count equals NumClasses + 1
for i from 0 to classifier.NumClasses
  value = classifier.ClassBreaks[i];

2019/08/15 01:14