In this attache code , I simply put 2 markers on the map and then use the function ZoomToPoints to adjust the map center/zoom and show them.
With some couple of coordinates like these, it happens one marker is outside the map, as in this picture (the upper marker is in the area of the top bar).
		
		
	
	
		 
	
Infact, the result of ShowBounds confirm that the map can't show the upper marker because it is outside the bounds.
So looks like the ZoomToPoints function fails sometime.
In other cases the two markers are inside the map, it depends on the couple of coordinates and the result is different.
I Tried to increase the padding in the ZoomToPoints function and can be considered a workaround but not nice because the two markers are not well centered in the available area.
So I'm thinking to another way to obtain the "ZoomToPoints". Any help is appreciated.
edit: I can't attach the project as ZIP because seems too large (??).
This is the code
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
and the GoogleMapsExtra class is taken from the tutorial
			
			With some couple of coordinates like these, it happens one marker is outside the map, as in this picture (the upper marker is in the area of the top bar).
Infact, the result of ShowBounds confirm that the map can't show the upper marker because it is outside the bounds.
So looks like the ZoomToPoints function fails sometime.
In other cases the two markers are inside the map, it depends on the couple of coordinates and the result is different.
I Tried to increase the padding in the ZoomToPoints function and can be considered a workaround but not nice because the two markers are not well centered in the available area.
So I'm thinking to another way to obtain the "ZoomToPoints". Any help is appreciated.
edit: I can't attach the project as ZIP because seems too large (??).
This is the code
			
				B4X:
			
		
		
		Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
    Private gmap As GoogleMap
    Private ApiKey As String = "AIzaSyAvyeV3neg9Jf-R2Y0Hh_zD-g8Jv-6Hx5Q"
    Dim gextra As GoogleMapsExtra
    Private Panel1 As Panel
    Private PointList As List
End Sub
Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.RootPanel.LoadLayout("1")
    NavControl.ShowPage(Page1)
    NavControl.ToolBarVisible=False
    NavControl.NavigationBarVisible=False
    PointList.Initialize
    Dim ll As LatLng
    ll.Initialize(46.57174,8.93102)
    PointList.Add(ll)
    Dim ll As LatLng
    ll.Initialize(45.57148, 8.93083)
    PointList.Add(ll)
    gmap.Initialize("gmap", ApiKey)
    Panel1.AddView(gmap, 0, 0, 100%X, 100%y)
    Dim ll As LatLng=PointList.Get(0)
    gmap.AddMarker(ll.Latitude,ll.Longitude,"test1")
    Dim ll As LatLng=PointList.Get(1)
    gmap.AddMarker(ll.Latitude, ll.Longitude, "test2")
    gextra.Initialize(gmap)
    gextra.ZoomToPoints(PointList)  
    ShowBounds
End Sub
Sub gmap_LongClick (Point As LatLng)
    gextra.ZoomToPoints(PointList)
    ShowBounds
End Sub
Sub ShowBounds
    Dim bounds As Object = gextra.GetVisibleBounds
    Dim ne_sw() As LatLng = gextra.GetBoundsNE_SW(bounds)
    Log(ne_sw(0))
    Log(ne_sw(1))
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
    If gmap.IsInitialized Then gmap.SetLayoutAnimated(0, 1, 0, 0, Width, Height)
    gextra.ZoomToPoints(PointList)
    ShowBounds
End Suband the GoogleMapsExtra class is taken from the tutorial
			
				Last edited: 
			
		
	
								
								
									
	
								
							
							 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		