Thanks, Jurgen.
One addendum: I might suggest having a bit more of a "defensive" coding
style when parsing our geocoding output, as the existence of elements is not
guaranteed.

So, something like this should work:
var placemark = addresses.Placemark[0];
adminName = placemark.AddressDetails && placemark.AddressDetails.Country &&
placemark.AddressDetails.Country.AdministrativeArea &&
placemark.AddressDetails.Country.AdministrativeAreaName;

If you think it is not that fun to parse the current output, you may want to
star this issue, reported by Marcelo:
http://code.google.com/p/gmaps-api-issues/issues/detail?id=606

- pamela

On Mon, Oct 27, 2008 at 2:24 PM, Jürgen <[EMAIL PROTECTED]>wrote:

>
> geocoder.getLocations(point, function(addresses) {
>    if(addresses.Status.code != 200) {
>        alert("reverse geocoder failed to find an address for " +
> point.toUrlValue());
>    }
>    else {
>        var state =
>
> addresses.Placemark[0].AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;
>        // do other stuff here
>     }
> }
>
> On 27 Okt., 02:16, Brekin <[EMAIL PROTECTED]> wrote:
> > Excellent Pamela. Looks really good.
> > What I need to be able to do is work out what State (in Australia) the
> > placemark is.
> > If you see a location in Australia (such ashttp://
> maps.google.com/maps/geo?output=xml&oe=utf-8&ll=-38.7617,143.3...)
> > you will notice that this is recorded under the
> > <AdministrativeAreaName>VIC</AdministrativeAreaName>
> > section. I must confess that XML/JavaScript is my weakness. How do you
> > access this property via JavaScript?
> > Thanks
> > Brett Kinross
> > On Oct 23, 10:44 am, "pamela (Google Employee)" <[EMAIL PROTECTED]>
> > wrote:
> >
> >
> >
> > > Hi developers-
> >
> > > I'm super excited to tell you that we now have reverse geocoding in
> > > the Maps API.
> >
> > >  Read this blog post for more information:
> http://googlegeodevelopers.blogspot.com/2008/10/geocoding-in-reverse....
> >
> > > Note that this resolves our #4 request in the issue tracker:
> http://code.google.com/p/gmaps-api-issues/issues/detail?id=134
> >
> > > Enjoy, and let me know what you create!
> >
> > > - pamela- Zitierten Text ausblenden -
> >
> > - Zitierten Text anzeigen -
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to