Overriding Onload to Set Layer Properties

We've set properties for CanvasMap to use data in attributes and to set properties for a specific feature in a layer or for individual features in a layer. This allows us a great deal of flexiblity in colorizing our maps, among other uses. The "SetFeaturePropery()" function will set a property for an individual feature using an index to that feature from 0 being the first feature in the layer. The "SetFeaturesProperties()" takes an array of key/value pairs with the keys being indexes to the features to change and the value being the property value to set.

See the CMLayer section of the Reference for more information on properties. Below is an example of each of the two functions and the US Census example uses this approach to uniquely colorize a data set of counties based on their popuplation.

// set the properties for one feature
TheLayer.SetFeatureProperty=function(CMLayer.FEATURE_STYLE,FeatureIndex,TheStyle)


// set the features for more than one feature
TheLayer.SetFeatureProperties(CMLayer.FEATURE_STYLE,FeatureStyles);