On Jan 10, 8:30 am, kpandelakis <[email protected]> wrote:
> I am creating a map that will load markers dynamically. Most times
> there will only be one market on the map.. other times there may be
> 10-15. I was able to get it working ok with multiple markers, but when
> only one marker loads the zoom is WAY too high. How can I control the
> zoom if only one marker loads? As you will see by my code, I just
> grabbed pieces-parts from other example I have found. I am not at all
> proficient in JavaScript.
>
> If you copy my code and uncomment out the additional maker data, you
> can see the "good" example.
>
> http://webpages.charter.net/korens/mapTest/MapTest.htm
>
> Thanks in advance for any help.

This is your problem:
   bounds.extend(myLatLng);
    map.fitBounds(bounds);

When you only have one marker, it zooms in as far as it can.  I would
suggest you test for that case (locations.length ==1) and set the
center to be the one marker and the zoom to a number you like...

   -- Larry

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to