B4J Question [SOLVED] jGoogleMaps: Markers are displayed multiple times

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

when building a google map first time, with two markers, the markers are displayed multiple times (see picture). By clicking on zoom, the map gets refreshed and the two markers are displayed correctly.
When rebuilding the map again with different markers, the markers are build correctly.

Have tried to init the cameraposition twice with different zoomlevels, but that did not solve the issue.

Any ideas?

upload_2016-1-11_17-21-47.png
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

Via trial-and-error :confused: solved by setting the cameraposition twice with different zoom levels.

B4X:
...
Utils.SetCameraPostion(MapTrack, llStart.Latitude, llStart.Longitude, ZoomLevel / 4)
Utils.SetCameraPostion(MapTrack, llStart.Latitude, llStart.Longitude, ZoomLevel)
...

Defined in a Utils Module
B4X:
#If B4J
Sub SetCameraPostion(mMap As GoogleMap, mLat As Double, mLon As Double, mZoomLevel As Float)
   Log("SetCameraposition: Zoomlevel=" & mZoomLevel)
   Dim cp As CameraPosition
   cp.Initialize(mLat, mLon, mZoomLevel)
   mMap.MoveCamera(cp)
End Sub
#End If
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
Just found a better solution !!!!! :)

USE .visible /// first false / then change position / then make it visible again!!!!

B4X:
Sub bam_tick
    boom.Enabled=False
    mark(hr).Visible=false
    Dim NewPosition As LatLng
    NewPosition.Initialize(ooo,15)
    ooo=10+NewPosition.Latitude+0.0001
    m(1).Position=NewPosition
     Sleep(50)
     mark(hr).Visible=True
    boom.Enabled=True
End Sub

YES!
 
Upvote 0
Top