I don’t know what’s your problem. Can you explain it to me? After review your code, I think you don’t need add point to different layer, you can add all points to one layer.
Please let me know if you have more questions. Thanks James
Sorry, I describe unclearly… Yes, I’d like to generate all points. Fist time, I generate all points in one layer. Second time, I input new array to this method, I have to redraw all points. but my code which just show one image of point…so how to midify it?
Your problem is that everytime when for each point you will add a new overlay and layer, so you can just show the last one.
My suggestion is that you can define layer and overlay outside, all points add the same layer and same overlay.
Dim imgLayer As New InMemoryFeatureLayer() Dim imgQueryResultsOverlay As New LayerOverlay()
Private Sub ShowImage(ByVal lonX() As Double, ByVal latY() As Double) For i As Integer = 0 To lonX.Length - 1 imgLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType = PointType.Bitmap imgLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.Image = New GeoImage("....gif") imgLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 imgLayer.InternalFeatures.Add("Car", New Feature(New PointShape(lonX(i), latY(i))))
If Not imgQueryResultsOverlay.Layers.Contains("imgLayer") Then imgQueryResultsOverlay.Layers.Add("imgLayer", imgLayer) End If If Not WinformsMap1.Overlays.Contains("imgQueryResultsOverlay") Then WinformsMap1.Overlays.Add("imgQueryResultsOverlay", imgQueryResultsOverlay) End If Next End Sub
My code as follows: Could you give me some idea? Thanks.
Public Sub ShowImage(ByVal lonX() As String, ByVal latY() As String, ByVal LT_Name() As String)
Dim columnValues As New Dictionary(Of String, String)
For j As Integer = 0 To lonX.Length - 1 columnValues.Add(j, LT_Name(j)) Next
For i As Integer = 0 To lonX.Length - 1 imgLayer.ZoomLevelSet.ZoomLevel08.DefaultPointStyle.PointType = PointType.Bitmap imgLayer.ZoomLevelSet.ZoomLevel08.DefaultPointStyle.Image = New GeoImage("…\United States.png") imgLayer.ZoomLevelSet.ZoomLevel08.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 imgLayer.InternalFeatures.Add(New Feature(New PointShape(lonX(i), latY(i)), columnValues(i)))
If Not imgQueryResultsOverlay.Layers.Contains("imgLayer") Then imgQueryResultsOverlay.Layers.Add("imgLayer", imgLayer) End If If Not WinformsMap1.Overlays.Contains("imgQueryResultsOverlay") Then WinformsMap1.Overlays.Add("imgQueryResultsOverlay", imgQueryResultsOverlay) End If Next End Sub
Public Sub ShowImage(ByVal lonX() As String, ByVal latY() As String, ByVal LT_Name() As String)
Dim columnValues As New Dictionary(Of String, String)
For j As Integer = 0 To lonX.Length - 1 columnValues.Add(j, LT_Name(j)) Next
For i As Integer = 0 To lonX.Length - 1 imgLayer.ZoomLevelSet.ZoomLevel08.DefaultPointStyle.PointType = PointType.Bitmap imgLayer.ZoomLevelSet.ZoomLevel08.DefaultPointStyle.Image = New GeoImage("...\United States.png") imgLayer.ZoomLevelSet.ZoomLevel08.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 Dim feature As New Feature(New PointShape(lonX(i), latY(i))) feature.ColumnValues.Add("name", columnValues(i)) imgLayer.InternalFeatures.Add(feature)
imgLayer.ZoomLevelSet.ZoomLevel08.DefaultTextStyle = TextStyles.Highway1("name") imgLayer.Open() If imgLayer.Columns.Count = 0 Then imgLayer.Columns.Add(New FeatureSourceColumn("name")) End If imgLayer.Close() If Not imgQueryResultsOverlay.Layers.Contains("imgLayer") Then imgQueryResultsOverlay.Layers.Add("imgLayer", imgLayer) End If If Not winformsMap1.Overlays.Contains("imgQueryResultsOverlay") Then winformsMap1.Overlays.Add("imgQueryResultsOverlay", imgQueryResultsOverlay) End If Next End Sub
Sorry, I have another question. I’d like to make sure one layer just shows one image? If I want to show different image picture by different status. Dose it have to divided many layers?
Thanks for your post and sorry for the delay for some problem in the discussion forum in the past few days.
The images on the layer are in fact labels of the Point features in the layer, so if you want show only one image on one layer. Probably one easy way is to create one layer for one feature as you did before.
I have many image which means different direction. if I’d like to show trace route of the car. each coordinates may be has different direction, so i have to show different image.
it have to retain trace route of the car (the car ever pass through), and insert a new image to show the car go to which direction currently.
do I have to create more layer?? could you give me some idea?
Thanks for your reply, Yale do you have a sample in vb.net?
and why you use mapEngine but not WinformsMap? (sorry, i am confused in mapEngine. i have not used mapEngine) What are they difference? in method of DrawImage(), it shows Map is undeclare…can i modify it to WinformsMap? but it shows image isn’t the member of ThinGeo.MapSuite.DesktopEdition.WinformsMap.
Attachment is the VB.net version of sample using Desktop Edition instead of Service edition.
The original sample is a service sample by using the Map Engine to draw directly, sorry for making the confusion. The change from service edition to Desktop Edition is you can ignore MapEngine, just add the layer to Winforms control, it will handle the draw stuff by itself.