webMapViewer and addLocation using array of location

hi,
i’m tring to using webMapViever by add an array of locations but its does not work

but it works if i add every single point
Has anyone had the same problem ?

this code does not works

Dim L() As WebMapLocation
Dim i As Integer
MapViewer1.Zoom=16
For i=0 To 50
  Dim u As New WebMapLocation(43.91045, 11.00712 +(i/100))
  L.Add(u)
Next i
MapViewer1.AddLocation(L)
MapViewer1.GoToLocation(L(0))

this code works

Dim L() As WebMapLocation
Dim i As Integer
MapViewer1.Zoom=16
For i=0 To 50
  Dim u As New WebMapLocation(43.91045, 11.00712 +(i/100))
  L.Add(u)
  MapViewer1.AddLocation(u)
Next i
MapViewer1.AddLocation(L)
MapViewer1.GoToLocation(L(0))

The first code works for me
Xojo 2023 R3

1 Like

It is important to mention the Xojo version you are using, platform, browser, sometimes even browser version.

I can confirm that first code doesn’t work with Xojo 2023r4 on my mac with Firefox and the second code works.

You should create an Issue for @Ricardo_Cruz to fix as it looks like this worked with Xojo 2023r3 (I don’t have that version here to test).

try i as double and

+(i/100.0)

maybe it was all at the same place?

No, is not the same place. If you try both code examples you can see the difference (with 2023r4), the first code should show something like this if you zoom out (produced by the second code):

If you change the GoToLocation and instead L(0) you use L(10) (or more) the map will center that location but there is no indictor (the blue pin with white circle).

Trying a double doesn’t change the output in 2023r4.

i just thought because integer division.

i have tried with 2023R4 and 2024R1

in 2023r4 there is another problem that disappears in 2024r1
this other problem is the position of dynamically added webcontainer control in other webcontainer
the vertical position of added control change if main container is on top of webpage or in the bottom part of the webpage
but i see that in 2024r1 the problem apperas solved

i use w10 pro

Sorry, I mixed up the versions.
For me, the first code works on Xojo 2023 R4 on Chrome, Windows 10

I used the functions in MapViewer1 → Opening()