After further reading/search (I have never done Geocoding before), I
found that the call actually return two sets of bounds.
The viewport (which I should use) and the actual bounds.

Following is what I use:

http://maps.googleapis.com/maps/api/geocode/json?address=russia&sensor=false

I got
{
  "status": "OK",
  "results": [ {
    "types": [ "country", "political" ],
    "formatted_address": "Russia",
    "address_components": [ {
      "long_name": "Russia",
      "short_name": "RU",
      "types": [ "country", "political" ]
    } ],
    "geometry": {
      "location": {
        "lat": 61.5240100,
        "lng": 105.3187560
      },
      "location_type": "APPROXIMATE",
      "viewport": {
        "southwest": {
          "lat": 31.2057644,
          "lng": 39.7523482
        },
        "northeast": {
          "lat": 76.9609558,
          "lng": 170.8851638
        }
      },
      "bounds": {
        "southwest": {
          "lat": 41.1853530,
          "lng": 19.6161000
        },
        "northeast": {
          "lat": 82.1673907,
          "lng": -168.9778800
        }
      }
    }
  } ]
}


On Oct 13, 7:58 pm, "[email protected]" <[email protected]>
wrote:
> On Oct 13, 5:43 pm, "[email protected]" <[email protected]>
> wrote:
>
> > On Oct 13, 5:21 pm, john <[email protected]> wrote:
>
> > > The east tip is about (-170 degree) and I simply make it (+180) to
> > > solve my problem.
> > > I was just curious. Also looking for a better way (instead of finding
> > > the box with my naked eyes).
>
> > The v2 geocoder returns the LatLonBox, that is what I would use (I
> > haven't looked at the v3 geocoder, but I would imagine it does the
> > same...)
> > And look... it even returns a google.maps.LatLngBounds called
> > "viewport":http://code.google.com/apis/maps/documentation/javascript/services.ht...
>
> Simple extension of the example referenced in that page:
>  http://www.geocodezip.com/v3_GoogleEx_geocoding-simple-bounds.html
>
>    -- Larry
>
>
>
>
>
> > > Thanks.
>
> > > John
>
> > > On Oct 13, 5:53 pm, "[email protected]" <[email protected]>
> > > wrote:
>
> > > > On Oct 13, 1:34 pm, john <[email protected]> wrote:
>
> > > > > Hi, there,
>
> > > > > Here is what I am doing now:
> > > > > Manually collect the bounds of the country (latNorth, lngEast,
> > > > > latSouth, lngWest) and save it in my country database. And with
> > > > > following (easy)
>
> > > > >             var ne = new google.maps.LatLng(latNorth, lngEast);
> > > > >             var sw = new google.maps.LatLng(latSouth, lngWest);
> > > > >             var bounds = new google.maps.LatLngBounds(sw, ne);
>
> > > > >             map.fitBounds(bounds);
>
> > > > > Now I want to show Russia. It's east end is actually belong to the
> > > > > other side of the world. So, my box can only extend east to 180, which
> > > > > is practically fine. I just curious if there a better way to do this.
>
> > > > > I saw a post (in v2) using GeoCoder but I failed to convert it to v3.
>
> > > > Below is what the geocoder returns for russia.  What happens if you
> > > > use the coordinates from the "LatLonBox" for your bounds?  (worked for
> > > > me...)
>
> > > >   -- Larry
>
> > > > {
> > > >   "id": "p1",
> > > >   "address": "Russia",
> > > >   "AddressDetails": {
> > > >     "Accuracy": 1,
> > > >     "Country": {
> > > >       "CountryName": "Russia",
> > > >       "CountryNameCode": "RU"
> > > >     }
> > > >   },
> > > >   "ExtendedData": {
> > > >     "LatLonBox": {
> > > >       "north": 76.9609558,
> > > >       "south": 31.2057644,
> > > >       "east": 170.8851638,
> > > >       "west": 39.7523482
> > > >     }
> > > >   },
> > > >   "Point": {
> > > >     "coordinates": [
> > > >       105.318756,
> > > >       61.52401,
> > > >       0
> > > >     ]
> > > >   }
>
> > > > }
>
> > > > > Thanks.
>
> > > > > John- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to