0

When I receive a geocode response from the GeoCode service from Google, it contains a recommended viewport describe as Lat/Lng pairs.

How can I zoom in/out to the recommended viewport ?

Simon
  • 2,208
  • 4
  • 32
  • 47

2 Answers2

1

In order to navigate to particular lat long you need to use the below method.

replace geopoint with your lat and long

mapView.animateTo(geopoint);
Shankar Agarwal
  • 34,573
  • 7
  • 66
  • 64
  • As you can see from the method name, this method moves to a lat/lng. It does not change the visible zoomed area area. What Google returns in its geocode answer is a Lat/Lng pair representing North East and South West coordinates. I am needing to change the zoom level to be as close to this bounded zone as possible. – Simon Apr 28 '12 at 14:54
1

The answer to this problem is to use MapController.zoomToSpan(...). Find the difference between the North/East coordinates and the South/West coordinates and then call the zoomToSpan method.

Fuller description can be found here Getting map zoom level for given bounds on Android like on JS Google Maps API: map.getBoundsZoomLevel(bounds) in user640688 posting.

Community
  • 1
  • 1
Simon
  • 2,208
  • 4
  • 32
  • 47