Drawing on a map

Post Reply
seany
Posts: 8
Joined: Friday 06th December 2019 3:09pm

Drawing on a map

Post by seany » Saturday 07th December 2019 11:23pm

Hello

I want to dynamically add points on a gb.map

I have :
Public Sub _New()

MapView1.Map.AddTile("OpenStreet", "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png")
 MapView1.Map.AddShape("P")

End
then, this function is called periodically :
Public Sub drawPoint()
  Dim c As String 
  c = Str(Rand(65, 90))
  Print "drawing " & pointLat & " " & pointLon & " " & timeStamp
 
  MapView1.Map["P"].AddPoint("c", MapPoint(pointLat, pointLon))
  MapView1.Map.Center(pointLat, pointLon)
  
End
I get the error : this key already exists in Fmain:20

How to solve this? Thank you

seany
Posts: 8
Joined: Friday 06th December 2019 3:09pm

Re: Drawing on a map

Post by seany » Sunday 08th December 2019 12:52am

Okey, I solved it by randomizing the key

Code: Select all

"c"
.

Having initiated the the key at the drawPoint function - given we are working with a pseudorandom - generate the same key every time.

Having generated the key at the loop where the drawPoint function is being called solves the issue.

Post Reply