setZoom() not working

2,236 views
Skip to first unread message

Michael Jennings

unread,
Jul 21, 2011, 1:32:21 AM7/21/11
to google-map...@googlegroups.com
Hi, for some reason I can't get setZoom() to work.

I call it in this function:

function there(mag){
        var sAddress = document.getElementById('address').value;
        geocoder.geocode({'address':sAddress},function(results,status){
        if (status == google.maps.GeocoderStatus.OK){
                map.setCenter(results[0].geometry.location);
                console.log(map);
                setZoom(16);
        } else {
                alert("Geocode was not successful for the following reason: " + status);
        }        }
);

The map center is changed just fine, and for some reason the when I inspect the source it actually says the zoom has been set to 16, but the map still shows the same zoom level. Any help?

Luke Mahé

unread,
Jul 21, 2011, 1:34:25 AM7/21/11
to google-map...@googlegroups.com
setZoom(16) to map.setZoom(16)
-- Luke


--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/wm6zdnH6HlsJ.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Michael Jennings

unread,
Jul 21, 2011, 1:37:42 AM7/21/11
to google-map...@googlegroups.com
oh sorry, thats what I had been doing, I just copied my code wrong. That doesn't work.

Luke Mahé

unread,
Jul 21, 2011, 1:41:34 AM7/21/11
to google-map...@googlegroups.com
Do you have a link that we can look at?

-- Luke


On Thu, Jul 21, 2011 at 3:37 PM, Michael Jennings <mjen...@dandb.com> wrote:
oh sorry, thats what I had been doing, I just copied my code wrong. That doesn't work.

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.

Michael Jennings

unread,
Jul 21, 2011, 1:49:16 AM7/21/11
to google-map...@googlegroups.com
No sorry, its just on my localhost.

Luke Mahé

unread,
Jul 21, 2011, 1:57:19 AM7/21/11
to google-map...@googlegroups.com
Then there's not much that we can do to help. Have a look at using jsfiddle.net or one of those sites where you can include code and send a link.

-- Luke


On Thu, Jul 21, 2011 at 3:49 PM, Michael Jennings <mjen...@dandb.com> wrote:
No sorry, its just on my localhost.

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.

Marwa Mekkawy

unread,
Dec 3, 2017, 5:35:20 PM12/3/17
to Google Maps JavaScript API v3
Reply all
Reply to author
Forward
0 new messages