, pointsLayer ) I've test if the problem cames from the image but it works perfectly in other enviroment (a picturebox for example or in a simple style with image).
I f anybody knows how to make it works I'll be really t
I'm sorry, your code is not displayed properly and I couldn't make it right as seems some code is lost. Can you repost the code again and following the instruction here? As you can see, with a couple lines of script you can make the code really nice.
Sorry, I don’t know what happens, there are some problems when you copy text from the Visual Studio. Here we go:
Dim pointsLayer As New InMemoryFeatureLayer
Dim style As New ValueStyle style.ColumnName = “ID” For Each row In ds.Tables(“Entity”).Rows Dim myStyle As New PointStyle myStyle.PointType = PointType.Bitmap myStyle.Image = New GeoImage(Imagenes(row(0).ToString)) style.ValueItems.Add(New ValueItem(row(0).ToString, myStyle)) Next
Your code is correct. As you didn’t provide codes how you add the features maybe something is wrong there. Please have a look at the complete code and see what’s the difference with yours.
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Add 2 Features to a Feature List Dim features As New List(Of Feature) ' The "ID" Column for these feature are "Truck1" and "Truck2" features.Add(New Feature(0, 0, "feature1", New String() {"ID:Truck1"})) features.Add(New Feature(30, 30, "feature2", New String() {"ID:Truck2"}))
' Create a new InMemoryFeatureLayer, the layer has one column "ID", got the 2 records we just created Dim column As New FeatureSourceColumn("ID") Dim pointsLayer As New InMemoryFeatureLayer(New FeatureSourceColumn() {column}, features)
' Create a dictionary For adding the ValueStyle later Dim dictionary As New Dictionary(Of String, String)() dictionary.Add("Truck1", "..\..\images\Truck1.png") dictionary.Add("Truck2", "..\..\images\Truck2.png")
' Create the valueStyle Dim style As New ValueStyle style.ColumnName = "ID" For Each item As KeyValuePair(Of String, String) In dictionary Dim myStyle As New PointStyle myStyle.PointType = PointType.Bitmap myStyle.Image = New GeoImage(item.Value) style.ValueItems.Add(New ValueItem(item.Key, myStyle)) Next
' Apply the style to layer pointsLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(style) pointsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
' Add the layer to map and draw WinformsMap1.StaticOverlay.Layers.Add("pointsLayer", pointsLayer) WinformsMap1.Refresh() End Sub