VDS Technologies

 

Make Different Symbol from spasial dataTable

5/7/2013 3:08:58 AM
Total Posts 50

Make Different Symbol from spasial dataTable

Hello,

How to make different symbol base on field/coloumn value.

I made this script but the symbol nothing to changed, see 'pinimage'.

 

 

Protected Sub OnRowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
StrFinder()

If e.Row.RowType = DataControlRowType.DataRow Then
map.Markers.Clear()
'----MARKER--------------

Dim adapterSMSNow As SqlDataAdapter = New SqlDataAdapter(StrQuery, con)
Dim dataTableSMSNow As DataTable = New DataTable()

adapterSMSNow.Fill(dataTableSMSNow)
adapterSMSNow.Dispose()

Dim dblayerSMSNow As Layer = map.AddPointDataLayer(dataTableSMSNow, "Latitude", "Longitude")
Dim rsNow As AspMap.Recordset = dblayerSMSNow.Recordset

dblayerSMSNow.UseDefaultSymbol = False

Dim maxRecords As Integer = rsNow.RecordCount

For record As Integer = 0 To maxRecords - 1
If rsNow.EOF Then ' no more records
Exit For
End If

Dim PcenterPoint As New AspMap.Point
PcenterPoint.Y = rsNow("Longitude").ToString()
PcenterPoint.X = rsNow("Latitude").ToString()

Dim pinimage As String
'get your values
Dim value1 As String = rsNow("Type").ToString()
'etc
Dim value2 As String = rsNow("Code").ToString()
Dim value3 As String = rsNow("Status").ToString()
Dim value4 As String = rsNow("Foto").ToString()

pinimage = ""
If value2 Like "L%" Or value3 = "OPEN" Then
pinimage = "Symbol/Fault_L_Open.png"
ElseIf value2 Like "M%" Or value3 = "OPEN" Then
pinimage = "Symbol/Fault_M_Open.png"
ElseIf value2 Like "G%" Or value3 = "OPEN" Then
pinimage = "Symbol/Fault_M_Open.png"
End If

Dim LayoutMap As String = "<aspmap:map id='map' runat='server' Width='100px' Height='100px' ImageFormat='Png'></aspmap:map>"

Dim image As MarkerSymbol = New MarkerSymbol(pinimage, 25, 35)

Dim tooltip As String = "<b>WorkID:</b> " & rsNow("WorkID").ToString & "<br><b>Sender:</b> " & rsNow("Sender").ToString & "<br>Code:</b> " & rsNow("Code").ToString & "<br><b> receivedtime</b>" & rsNow("receivedtime").ToString & "<br/><img src=" & value4 & """ width=""100px"" heigth=""150px""> "

'CLatitude.Text = rsNow("Latitude").ToString()
'Dim html As String = "<b>WorkID:</b> " & rsNow("WorkID").ToString & "<br><b>Sender:</b> " & rsNow("Sender").ToString & "<br>Code:</b> " & rsNow("Code").ToString & "<br><b> receivedtime</b>" & rsNow("receivedtime").ToString & "<br/><img src=" & value4 & """ width=""100"" heigth=""150""> " & "<p><a href='#Mappopup?' id='link' runat='server' data-role='button' data-rel='dialog' data-transition='slide' data-ajax='false'>View Image</a></p>"

Dim html As String = "<b>WorkID:</b> " & rsNow("WorkID").ToString & "<br><b>Sender:</b> " & rsNow("Sender").ToString & "<br>Code:</b> " & rsNow("Code").ToString & "<br><b> receivedtime</b>" & rsNow("receivedtime").ToString & "<br/><img src=" & value4 & """ width=""100"" heigth=""150""> "

Dim marker As AspMap.Web.Marker = New AspMap.Web.Marker(map.CoordinateSystem.FromWgs84(PcenterPoint), image, tooltip, html)

map.Markers.Add(marker)

map.Markers.CoordinateSystem = New AspMap.CoordSystem(AspMap.CoordSystemCode.GCS_WGS84)
rsNow.MoveNext()

Next record

End If

End Sub