Editing Map Layer Attributes
Map layers can have their own attributes. These are defined in the Layer Attributes pane of the Inspector, with the Map Layer selected.
Map layer function editing is very similar to CGA shape grammar editing. But only a subset of functions are available for attribute layers and no rules or shape operations. Use the command completion CTRL+SPACE to see a list of available functions.
- attr elevation controls the elevation of the heightmap of a terrain layer.
- attr obstacle controls the obstacle avoidance of the street generation.
Examples for function layer attributes:
attr elevation = sin(u * 6.3) * cos(v * 6.3) * 100
|Create a terrain as a function of sine and cosine.|
attr obstacle = brightness > 0.5
|Define all bright parts of an image map as obstacles.|
attr height = exp(u * 5)
|Control the height attribute of a rule file with this exponential function.|
attr selection = rand > 0.5
|Define a boolean attribute that can be used for selection to select 50% of the objects randomly.|
attr landuse = case u > 0.5: 50%: "industrial" else: "retail" else: "residential"
|Define a string attribute that can be used by a CGA shape grammar rule to control e.g. building appearance.|
Layer Attribute Code in Detail
Map layers in general define one or more attributes as a function of the location and optionally a mapping channel. The dimension of the map are normalized to the interval [0..1]. Thus the lower left corner of your map has the coordinates (0, 0) and the upper right corner of the map has the coordinates (1, 1). The normalized position is available as the predefined values "u" and "v" respectively for attribute functions. For example the following function will control the elevation by trigonometric functions:
attr PI2 = 3.141 * 2 // approx. 2 x PI
attr elevation = sin(u * PI2) * cos(v * PI2) * 100
In addition to that, inside an attribute function, "red", "green", "blue", "alpha", "hue", "saturation", "brightness" address the individual channels of the map. For each object, the attribute function is evaluated with the projection of the center of gravity (centroid) to the x-z plane.
In the following illustration, the attribute "x" is evaluated at the center of gravity (centroid) of the object which is mapped onto the standard [0..1] range for the "u" and "v" parameters. In addition to that, the map is sampled at the position "u,v" and its red channel is used for the calculation of "x".
- Connection Editor
- Mapping Object Attributes via Layer Attribute
- Mapping Image Data to Rule Attributes
- Attributes and Sources
Copyright ©2008-2017 Esri R&D Center Zurich. All rights reserved.