Hi Ross,
Wow...I got the Reverse Geocoding to work now. At least for when the
user had drag the marker.
place = response.Placemark[0];
document.getElementById("statcode").value=
response.Status.code;
document.getElementById("statreq").value=
response.Status.request;
document.getElementById("address").value= place.address;
document.getElementById("acc").value=
place.AddressDetails.Accuracy;
document.getElementById("country").value=
place.AddressDetails.Country.CountryNameCode;
GEvent.addListener(marker, "dragend", getAddress);
I needed to have the Placemark and then use it to populate some of the
textfields!
This is great...although I haven't been able to get it to work when
then marker isn't dragged. I will try that this evening...I will come
back with the results...:-)
One question: I thought the response it self contained all the needed
information such as addrss, AddressDetails.Accuracy, etc...why do I
need to us place = response.Placemark[0]; to get all info? Maybe a
strange question but I need to learn as well...
/Nimrod
On May 8, 9:26 pm, Rossko <[email protected]> wrote:
> > 1. I get statuscode 200 but get "undefined" for the address...strange.
> > How is that?
>
> Looking at your showNewAddress function ...
> function showNewAddress (response) {
> ....
> document.getElementById("statcode").value= response.Status.code;
> OK so far, its processing a geocode return that it is calling
> 'response' ...
> ....
> document.getElementById("address").value= place.address;
> What's that? This is the first time anyones mentioned 'place' ....
>
> document.getElementById("acc").value=
> response.AddressDetails.Accuracy;
> What's that?? You can't make up names for the geocoder's returned
> data. See
> -http://code.google.com/apis/maps/documentation/services.html#Geocodin...
>
> Go back to the source example -
> http://code.google.com/intl/sv/apis/maps/documentation/examples/geoco...
> Observe that they extract a subset of the data from the response
> place = response.Placemark[0];
> and then display parts of that subset
>
> > 2. I do not get the statuscode 200 when the marker is directly placed
> > on the map. How should I attack that problem. Somehow I need to call
> > the function getAddress(). Should I have a new listener and when the
> > marker is placed the getAddress is called?
>
> There won't be anything to listen for if the user isn't going to do
> anything to the marker.
> Why not just call getAddress(themarkerslatlng) in the bit of code that
> places the marker.
>
> chees, Ross K
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---