Displaying Features and Symbolizing Attributes


 

 

 

To change the symbol associated with vector data:

 

Assuming you have a Layer that has been added to a Map, change any of the properties of the Symbol object that is associated with the Layer.

Dim layer As Layer
layer = Map1.AddLayer("states.shp")
layer.Symbol.FillStyle = FillStyle.UpwardDiagonal
layer.Symbol.FillColor = Color.Red

 

To display vector data based on attribute data:

 

  1. Assuming you have a Layer that has been added to a Map, set the appropriate properties for the renderer.
     

  2. For example, can use the renderer to display unique values. You should specify a Field whose values will serve as the basis for the thematic map.
     

  3. Or, you can use the renderer to display attribute data based on expressions. You should specify an Expression to filter features you want to highlight:

Map1.AddLayer("states.shp")

Dim feature As Feature
feature = map("states").Renderer.Add()

feature.Expression = "SUB_REGION = ""Pacific"""
feature.Symbol.FillColor = Color.Green

 

To add text labels to a map:

 

  1. Assuming you have a Layer that has been added to a Map, set the ShowLabels property to True.

  2. Specify the LabelField property to set the field whose values contain the text to be displayed on the Map.

  3. Use the LabelFont property to set the appropriate properties of the label's font.

  4. Set the DuplicateLabels property to control whether or not to allow duplicate labels.

 

Dim layer As Layer
layer = Map1.AddLayer("states.shp")

layer.LabelField = "NAME"
layer.ShowLabels = True

layer.LabelFont.Outline = True
layer.LabelFont.Size = 14
layer.LabelFont.Bold = True

 


 

To display a raster image:

 

  1. Find the location of the image on disk.

  2. Verify that the image is geo-referenced.

  3. Add the image to the Map:
     

Map1.AddLayer(MapPath("../Maps/earth.ecw"))

 


 

To draw graphics on the map:

 

  1. Create a shape. The shape can be a geometric shape created in code or it can be a layer feature.

  2. Add the shape to the MapShapes collection as a MapShape object. The shapes in the MapShapes collection are persisted between postbacks.

  3. Specify its properties, such as its styles and colors:
     

Dim state As Recordset

Map1.AddLayer("states.shp")

state = Map1("states").SearchExpression("STATE_ABBR = ""WY""")

Dim ms As MapShape = Map1.MapShapes.Add(state.Shape)

ms.Symbol.FillColor = Color.Green
ms.Symbol.Size = 1



 

To display locations dynamically  using the DynamicPoints:

 

  1. Create a DynamicPoints object.

  2. Call the Add method to add the coordinates of the locations and their labels to the DynamicPoints object.

  3. Add the DynamicPoints object to the Map as a new Layer.

  4. Set the properties of the newly added layer to highlight the locations:

Dim pointLayer As Layer

' create a DynamicPoints object
Dim dynPoints As DynamicPoints = new DynamicPoints(LayerType.Point)
 
' add points
dynPoints.Add(-150.20, 64.80, "Point 1")
dynPoints.Add(-119.27, 44.12, "Point 2")
dynPoints.Add(-100.84, 43.80, "Point 3")

' add points as a new Layer
pointLayer = Map1.AddLayer(dynPoints)

' set the parameters of the newly added point layer
pointLayer.Symbol.Size = 14
pointLayer.Symbol.PointStyle = PointStyle.Star
pointLayer.Symbol.FillColor = Color.Blue
pointLayer.ShowLabels = True
pointLayer.LabelFont.Size = 16
pointLayer.LabelFont.Outline = True


 

To display a highway shield:

 

  1. Assuming you have a highway Layer that has been added to a Map, set the LabelStyle property to Shield.

  2. Set the appearance of the shield using the ShieldSymbol property.

  3. Specify the LabelField property to set the field whose values contain the text to be displayed on the shield.

  4. Set the ShowLabels property to True.

Dim mapLayer as Layer

mapLayer = Map1.AddLayer(MapPath("roads.shp"))

' set shield labeling style
mapLayer.LabelStyle = LabelStyle.Shield

' set shield appearance
mapLayer.ShieldSymbol.PointStyle = PointStyle.Bitmap
mapLayer.ShieldSymbol.Bitmap = MapPath("interstate_highway.bmp")
mapLayer.ShieldSymbol.Size = 20
mapLayer.ShieldSymbol.TransparentColor = Color.White

' enable labels
mapLayer.ShowLabels = True
mapLayer.LabelField = "NUMBER"

' set label font size & color
mapLayer.LabelFont.Size = 12
mapLayer.LabelFont.Color = Color.White

' set road style & colors
mapLayer.Symbol.LineStyle = LineStyle.Road
mapLayer.Symbol.Size = 5
mapLayer.Symbol.LineColor = Color.Brown
mapLayer.Symbol.InnerColor = Color.LightGray

 

 

© 2018 VDS Technologies
Converted from CHM to HTML with chm2web Standard 2.85 (unicode)