set Center and Zoom level according to a country

4,461 views
Skip to first unread message

vincent14

unread,
Mar 2, 2010, 7:17:52 AM3/2/10
to Google Maps JavaScript API v3

Hello
it is not possible to show a Country, without using LatLng and Zoom
factor, but direct with the country name?
have a nice day
vincent


function initialize() {
var latlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: *, // as Big the country is Andora would have a differnt
Zoom Level then China
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};

pete

unread,
Mar 2, 2010, 4:13:07 PM3/2/10
to Google Maps JavaScript API v3
You need to use the Geocoder service to position a map by location
name
http://code.google.com/apis/maps/documentation/v3/examples/geocoding-simple.html

Randy Johnson

unread,
Mar 5, 2010, 3:28:02 PM3/5/10
to Google Maps JavaScript API v3
Is there a way to let the Google Maps API choose the zoom level when
using the geocoder service to show a country?

Thanks!

Randy

On Mar 2, 4:13 pm, pete <petejun...@gmail.com> wrote:
> You need to use the Geocoder service to position a map by location

> namehttp://code.google.com/apis/maps/documentation/v3/examples/geocoding-...


>
> On Mar 2, 11:17 pm, vincent14 <vkoc...@weltmeer.ch> wrote:
>
>
>
> > Hello

> > it is not possible to show aCountry, without using LatLng and Zoom


> > factor, but direct with thecountryname?
> > have a nice day
> > vincent
>
> >  function initialize() {
> >     var latlng = new google.maps.LatLng(-34.397, 150.644);
> >     var myOptions = {

> >       zoom: *, // as Big thecountryis Andora would have a differnt

Brak

unread,
Mar 5, 2010, 3:37:57 PM3/5/10
to Google Maps JavaScript API v3
If you know the dimensions of a country, you could come up with a
LatLngBounds object, which you could use to automatically set the zoom
level to the right size. You just need the corners, technically.

http://code.google.com/apis/maps/documentation/v3/reference.html#LatLngBounds

Randy Johnson

unread,
Mar 5, 2010, 3:40:14 PM3/5/10
to google-map...@googlegroups.com
Thank you,  I will do some research on that and see what I can come up with.

Randy


--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
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.


Marcelo

unread,
Mar 5, 2010, 4:37:13 PM3/5/10
to Google Maps JavaScript API v3
On Mar 5, 9:40 pm, Randy Johnson <rjohnso...@gmail.com> wrote:
> Thank you,  I will do some research on that and see what I can come up with.
>

Here are the bounding boxes:
http://nearby.org.uk/coords/countries.csv

--
Marcelo - http://maps.forum.nu
--


> Randy
>
>
>
> On Fri, Mar 5, 2010 at 3:37 PM, Brak <brak.steph...@gmail.com> wrote:
> > If you know the dimensions of a country, you could come up with a
> > LatLngBounds object, which you could use to automatically set the zoom
> > level to the right size. You just need the corners, technically.
>

> >http://code.google.com/apis/maps/documentation/v3/reference.html#LatL...

> > google-maps-js-a...@googlegroups.com<google-maps-js-api-v3%2B unsub...@googlegroups.com>

vincent14

unread,
Mar 7, 2010, 4:49:09 AM3/7/10
to Google Maps JavaScript API v3
Reply all
Reply to author
Forward
0 new messages