2

Is there a way to make Google Maps zoom to a certain level based on what is being searched? For instance, if I am searching for a street, then when I search for the street, google maps would zoom to the street level.

When I am searching for a city, the google maps will zoom to the city level, etc ...

Thanks

Kara
  • 6,115
  • 16
  • 50
  • 57
Bill
  • 2,026
  • 9
  • 55
  • 99
  • What does "zoom to the street level" or "zoom to the city level" mean? Zoom levels are defined by integers, not by phrases. – Marcelo Sep 16 '12 at 13:34

2 Answers2

1

try this below links, here you will have some different maps level information. https://developers.google.com/maps/documentation/staticmaps/#MapTypes

and

How to set google map custom zoom level dynamically?

Google Maps v3 - limit viewable area and zoom level

it may help you.

Community
  • 1
  • 1
bashu
  • 1,710
  • 12
  • 16
1

Actually, I solved this issue using the following line of code:

map.fitBounds(results[0].geometry.viewport);

I use the above line of code after I get a Status "OK" from geocoding web service. It works fine.

Bill
  • 2,026
  • 9
  • 55
  • 99
  • What Class is object map? MapView doesn't have fitBounds method. Same question for object results[0]. Is it meant to be Address as result of geoCoder.getFromLocationName ? But again no geometry member... – MSquare Apr 23 '13 at 11:52
  • Seems like you guys are in JavaScript, and I am in Android waters. Sorry about that... I have the same problem in Android. :-S – MSquare Apr 23 '13 at 12:00