Map will not zoom in past 19!

439 views
Skip to first unread message

Mapper99

unread,
Feb 25, 2012, 11:24:54 PM2/25/12
to google-map...@googlegroups.com
I can't get my map to zoom in past level 19 using the v3 API:

case 'Filingue': map.setCenter(new google.maps.LatLng(14.355961,3.320918));map.setZoom(21); map.setMapTypeId(google.maps.MapTypeId.HYBRID); break;

This area supports more zoom levels:


Any idea why this won't work?  Is there something I need to set when I initialize my map?  Works fine in the v2 API.

Thanks in advance,

M

Mapper99

unread,
Feb 25, 2012, 11:31:44 PM2/25/12
to google-map...@googlegroups.com
My bad...FYI - if anyone else is experiencing this, just ensure the map type is set before you zoom.  It appears the HYBRID map type and the SATELLITE map type share the same imagery, just not the same amount of zoom levels!

case 'Filingue': map.setCenter(new google.maps.LatLng(14.355961,3.320918));map.setMapTypeId(google.maps.MapTypeId.SATELLITE); map.setZoom(21);  break; 

Works like a charm.  Great imagery by the way.

M

Mapper99

unread,
Feb 27, 2012, 12:12:56 AM2/27/12
to google-map...@googlegroups.com
Actually, this issue is still not solved.

Here is my zoom code:

function QuickZoom(location){
if (map.getMapTypeId() == "arcgis"){
map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
}
switch (location) {
        case 'Kenya': map.setCenter(new google.maps.LatLng(0.045308,  37.659934)); map.setZoom(22); break;
         case 'Niger Desert':   map.setCenter(new google.maps.LatLng(20.197507, 12.964894)); map.setZoom(22); break;
         case 'Zinder': map.setCenter(new google.maps.LatLng(13.789515,9.000553));   map.setZoom(22); break;
        case 'India': map.setCenter(new google.maps.LatLng(21.567350, 76.135597)); map.setZoom(19); break;
         case 'Filingue': map.setCenter(new google.maps.LatLng(14.355961,3.320918));   map.setZoom(22); break;
         default: break;
         }

}

The actual map can be viewed here. 



Click the Kenya, Niger Desert, etc links.  If you click on the Kenya link, the map zooms in fine.  If you click on the "Niger Desert" link, the map only zooms to zoom level 19.  It should be 22.  If you click on the "Niger Desert" link again, the map will zoom into 22.

Any idea why this is happening?

Thanks in advance,

M

geoco...@gmail.com

unread,
Feb 27, 2012, 12:47:13 PM2/27/12
to Google Maps JavaScript API v3
Two thoughts:
1. do the setCenter, wait for the center to change (wait for the
center_changed event to fire), then do the zoom.
2. code the zoom in two stages, setCenter/zoom to 19; zoom to 22.
Perhaps put the second zoom in a zoom_changed handler.

-- Larry

-- Larry

>
> Thanks in advance,
>
> M
>
>
>
>
>
>
>
> On Saturday, February 25, 2012 8:31:44 PM UTC-8, Mapper99 wrote:
>
> > My bad...FYI - if anyone else is experiencing this, just ensure the map
> > type is set before you zoom.  It appears the HYBRID map type and the
> > SATELLITE map type share the same imagery, just not the same amount of zoom
> > levels!
>
> > case 'Filingue': map.setCenter(new google.maps.LatLng(14.355961,
> > 3.320918));map.setMapTypeId(google.maps.MapTypeId.SATELLITE); map.setZoom(21);
> >  break;
>
> > Works like a charm.  Great imagery by the way.
>
> > M
>
> > On Saturday, February 25, 2012 8:24:54 PM UTC-8, Mapper99 wrote:
>
> >> I can't get my map to zoom in past level 19 using the v3 API:
>
> >> case 'Filingue': map.setCenter(new
> >> google.maps.LatLng(14.355961,3.320918));map.setZoom(21);
> >> map.setMapTypeId(google.maps.MapTypeId.HYBRID); break;
>
> >> This area supports more zoom levels:
>
> >>http://maps.google.ca/maps?q=14.355961,3.320918&hl=en&ll=14.355961,3....

Mapper99

unread,
Feb 27, 2012, 10:09:47 PM2/27/12
to google-map...@googlegroups.com
Thanks Larry...

Those sound like good suggestions.  I still would like to get to the bottom of the issues though.  I'm interested to know if I have coded something incorrectly.

geoco...@gmail.com

unread,
Feb 28, 2012, 12:17:27 AM2/28/12
to Google Maps JavaScript API v3
I don't think you coded anything incorrectly.

My theory is that the base map supports up to zoom level 19. If you
want to zoom in further than that you have to be a a location that
supports the higher zoom level. So, therefore suggestion #1 might
work, if you re-position the map first, then zoom in, it might not
also.

Suggestion #2 is basically doing what you know works, but
programmatically.

But neither work. Seems that the api can't load the zoom level 22
tiles (it is getting 404 file not found on them) at the higher zoom
levels (at least in Chrome). Seems like it might be a bug.
> ...
>
> read more »

geoco...@gmail.com

unread,
Feb 28, 2012, 5:37:43 AM2/28/12
to Google Maps JavaScript API v3
On Feb 27, 9:17 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
Test page:

http://www.geocodezip.com/v3_world_countries_testZoom.html
> ...
>
> read more »

Mapper99

unread,
Feb 28, 2012, 2:25:48 PM2/28/12
to google-map...@googlegroups.com
Wow.  Thanks for checking this out for me.  It worked like a charm using the v2 API - http://www.save-the-rain.com

I can always add a tooltip on hover that lets the user know to click twice to get the high re version.

Cheers,

m

upsi...@bluewin.ch

unread,
Feb 28, 2012, 4:56:40 PM2/28/12
to google-map...@googlegroups.com
Hi there,

I hope someone can help!

Goal: implement a custom search (geocode) function and be able to list and click
each result and display it on the map.

Wanted: Adjust map bounds / zoom level accordingly, i.e. searching for "MA,
USA" should zoom the map to let me see the whole Massachusetts state, while searching for "Boston, MA, USA" should zoom
on the Boston area. When listing multiple results, the same should apply when clicking on a result.

Issue: I can use
the geometry.bounds object with fitBounds - but - some results you get using the geocoder do not have that geometry.
bounds object.

A quick example: searching for "Boston" returns

Boston, MA, USA
Boston, IN, USA
Boston, KY, USA

Boston, GA 31626, USA
Boston, Salem, VA 22713, USA
Boston, NY 14025, USA

Both "Boston, KY" and "Boston NY 14025" do
not have bounds.

Question: Is there a reliable way to display any geocoder result on a map at the appropriate zoom
level?
I know I can use setCenter with geometry.location, but that won't cover the zoom issue...

Any help will be
appreciated!
Thanks

MrUpsidown

unread,
Feb 28, 2012, 5:12:59 PM2/28/12
to Google Maps JavaScript API v3
That message should not be here...

MrUpsidown

unread,
Feb 28, 2012, 5:18:12 PM2/28/12
to Google Maps JavaScript API v3
Hi there,

I hope someone can help!

Goal: implement a custom search (geocode) function and be able to list
and click each result and display it on the map.

Wanted: Adjust map bounds / zoom level accordingly, i.e. searching for
"MA, USA" should zoom the map to let me see the whole Massachusetts
state, while searching for "Boston, MA, USA" should zoom on the Boston
area. When listing multiple results, the same should apply when
clicking on a result.

Issue: I can use the geometry.bounds object with fitBounds - but -
some results you get using the geocoder do not have that
geometry.bounds object.

A quick example: searching for "Boston" returns

Boston, MA, USA
Boston, IN, USA
Boston, KY, USA

Boston, GA 31626, USA
Boston, Salem, VA 22713, USA
Boston, NY 14025, USA

Both "Boston, KY" and "Boston NY 14025" do not have bounds.

Question: Is there a reliable way to display any geocoder result on a
map at the appropriate zoom level?
I know I can use setCenter with geometry.location, but that won't
cover the zoom issue...

Any help will be appreciated!
Thanks

PS. Sorry for the double post / changing the other thread title, etc.
don't know what I did...
Reply all
Reply to author
Forward
0 new messages