1
Answer

Map center/zoom prob while displaying markers on Google MAps

Nel

Nel

9y
664
1

Hi,


I display only two markers currently on Google MAps But they are very sparsely displayed on the map, like with a very big zoom I tried to change the zoom, but it remains the same

I use

 var mcenter = new google.maps.LatLng(26.675563, -80.051483), 
                markers,
                   myMapOptions = {
                       zoom: 16, //16

                      // center: mcenter,  //commented 03.17 in order to get the center of the map/markers automatically
                       mapTypeId: google.maps.MapTypeId.ROADMAP
                   },
               map = new google.maps.Map(document.getElementById("map_canvas"), myMapOptions);
            var bounds = new google.maps.LatLngBounds();
            map.fitBounds(bounds);

I use the last two row in order to avoid manually giving the coordinates for the map center, since it is changeable, depending on what the user choose to display on the map

When I used the app for displaying more markers, there wasn't a problem, but only for two of  them there is, they don't look good on the map, and also one of them is behind my legend

Can anybody help me please how to make the two markers look good when displayed on the map, not being far away from one another, on both ends left, and right on the map?

Thank you


Answers (1)