Thursday, October 23, 2008

Reverse GClientGeocoder

Pamela announced a few hours ago that the much requested feature is here. Great. I made a random click on the example page and saved the server response.



_xdc_._1fmnhtk4s && _xdc_._1fmnhtk4s({
"name":"-122.124367,37.436975",
"Status":{
"code":200,
"request":"geocode"
},
"Placemark":[{
"id":"p1",
"address":"870 Bruce Dr, Palo Alto, CA 94303, USA",
"AddressDetails":{
"Country":{
"CountryNameCode":"US",
"CountryName":"USA",
"AdministrativeArea":{
"AdministrativeAreaName":"CA",
"Locality":{
"LocalityName":"Palo Alto",
"Thoroughfare":{
"ThoroughfareName":"870 Bruce Dr"
},
"PostalCode":{
"PostalCodeNumber":"94303"
}
}
}
},
"Accuracy": 8
},
"Point":{
"coordinates":[-122.124557,37.437032,0]
}
}]
})

I don't know who's address that is but you can see the structure.

The query is given conveniently as a GLatLng() to the GClientGeocoder.getLocations() as you can see in the updated documentation.

So the client side script makes the decision wheter we send geocode or reverse-geocode request. That is clever.

The new feature is a perfect building brick for my next csv generator page. I was just intending to publish the page!

See a temporary test page.

No comments: