Another Way To Create Layers

The method described in the previous section is easy to use, but requires a layer definition be created first through the Infrastructure Studio UI. An alternative approach is to use the methods defined in

WebServerExtensions\www\mapviewerphp\layerdefinitionfactory.php.

This file contains several functions, which can be used to build up a layer definition. The parameters of these functions enable you to set the most commonly used settings. (If you need to change other settings, you will have to either use the Infrastructure Studio UI, or modify the XML of the layer definition.)

The layerdefinitionfactory is only available for PHP. For development using ASP.NET, a good alternative is to use the Visual Studio tool xsd.exe to generate .NET classes for the LayerDefinition schema.

Function Parameter Description
CreateLayerDefinition() $resourceId The repository path of the feature source for the layer. For example: Library://Samples/Sheboygan/Data/Parcels.FeatureSource. Equivalent to the Data resource used in this layer field in Infrastructure Studio’s layer editor.
$featureClass The feature class to use. For example, SHP_Schema:Parcels. Equivalent to the Feature class field in Infrastructure Studio’s layer editor.
$geometry The geometry to use from the feature class. For example, SHPGEOM. Equivalent to the Geometry field in Infrastructure Studio’s layer editor.
$featureClassRange A scale range created by filling in a scale range template (ScaleRange.templ).
CreateScaleRange() $minScale The minimum scale range to which this rule applies. Equivalent to the From field in Infrastructure Studio’s layer editor.
$maxScale The maximum scale range to which this rule applies. Equivalent to the To field in Infrastructure Studio’s layer editor.
$typeStyle A type style created by using CreateAreaTypeStyle(), CreateLineTypeStyle() or CreatePointTypeStyle().
CreateAreaTypeStyle() $areaRules One or more area rules, created by CreateAreaRule.
CreateAreaRule() $legendLabel The text for the label shown beside this rule in the legend. Equivalent to the Legend Label field in Infrastructure Studio’s layer editor.
$filterText The filter expression that determines which features match this rule. For example, SQFT >= 1 AND SQFT < 800. Equivalent to the Condition field in Infrastructure Studio’s layer editor.
$foreGroundColor The color to be applied to areas that match this rule. Equivalent to the Foreground color field in Infrastructure Studio’s layer editor.
CreateTextSymbol() $text The string for the text.
$fontHeight The height for the font.
$foregroundColor The foreground color.
CreatePointTypeStyle() $pointRule One or more point rules, created by CreatePointRule().
CreatePointRule() $legendLabel The label shown beside this rule in the legend. Equivalent to the Legend label field in Infrastructure Studio’s layer editor.
  $filter The filter expression that determines which features match this rule. Equivalent to the Condition field in Infrastructure Studio’s layer editor.
  $label The text symbol, created by CreateTextSymbol().
  $pointSym A mark symbol created by CreateMarkSymbol().
CreateMarkSymbol() $resourceId The resource ID of the symbol used to mark each point. For example, library://Samples/Sheboygan/Symbols/BasicSymbols.SymbolLibrary. Equivalent to the Location field in the Select a symbol from a Symbol Library dialog in Infrastructure Studio’s layer editor.
$symbolName The name of the desired symbol in the symbol library.
$width The width of the symbol (in points). Equivalent to the Width field in the Style Point dialog in Infrastructure Studio’s layer editor.
$height The height of the symbol (in points). Equivalent to the Height field in the Style Point dialog in Infrastructure Studio’s layer editor.
$color The color for the symbol. Equivalent to the Foreground color field in the Style Point dialog in Infrastructure Studio’s layer editor.
CreateLineTypeStyle() $lineRules One or more line rules, created by CreateLineRule().
CreateLineRule() $color The color to be applied to lines that match this rule. Equivalent to the Color field in Infrastructure Studio’s layer editor.
$legendLabel The label shown beside this rule in the legend. Equivalent to the Legend Label field in Infrastructure Studio’s layer editor.
$filter The filter expression that determines which features match this rule. Equivalent to the Condition field in Infrastructure Studio’s layer editor.

For more information on these settings, see the Studio Help.