Anuj Kabra
Anuj Kabra

Reputation: 61

To Show A Country Map Using Google Maps API

Can I display a Country's Map passing the country name as parameter to Google Maps API? The display field area is same for all the countries so the zoom level should adjust automatically to fit the corresponding country in.

I have tried Using GLatLongBounds but its no good as USA in 800X800 is fine but Japan is a Dot.

Upvotes: 2

Views: 2258

Answers (2)

James Goodwin
James Goodwin

Reputation: 7406

If you are already have the GLatLongBounds of the country, you can just do: GMap2.getBoundsZoomLevel(GLatLongBounds) to get the appropriate zoom level to show those bounds.

From the Google Maps API:

getBoundsZoomLevel(bounds:GLatLngBounds)

Returns the zoom level at which the given rectangular region fits in the map view. The zoom level is computed for the currently selected map type. If no map type is selected yet, the first on the list of map types is used.

Upvotes: 3

jerebear
jerebear

Reputation: 6655

I'm pretty confident you'll need to pass the zoom level as well as the country name (or lat/long coords) to get the proper bounding.

Upvotes: 0

Related Questions