> You need to either create a new GClientGeocoder object for each
> request, or make each new request from within the callback function,
> after the previous call has completed.
So I changed the code to:
function showAddress(stories, map, geocoder) {
geocoder.getLatLng(stories.city, function(latlng) {
if (latlng == null) {
GLog.write("Null latitude/longitude for " +
stories.company + " at " + stories.city)
return;
}
marker = new GMarker(latlng);
var html =
"<a href=\"" + stories.website + "\">" +
stories.company +
"</a><br>" +
"<a href=\"" + stories.story + "\">Stories
entry</a><br>" +
"<a href=\"" + stories.questionnaire +
"\">Detailed Q&A</a><br>" +
stories.industry + "<br>" +
"";
marker.bindInfoWindowHtml(html);
map.setCenter(latlng, 1);
map.addOverlay(marker);
//GLog.write("" + stories.company + " plotted at
\"" + stories.city + "\"")
totalPlotted = totalPlotted + 1;
});
}
function geocode(stories, map) {
geocoder = new GClientGeocoder();
showAddress(stories, map, geocoder);
}
function initialize() {
GDownloadUrl("stories.json", function(stories,
responseCode) {
stories = eval(stories);
if (GBrowserIsCompatible()) {
//geocoder = new GClientGeocoder();
var map = createMap();
for (i=0; i<stories.length; i++) {
geocode(stories[i], map);
}
}
});
}
but didn't help.
>
> In any case, the geocoder at maps.google.com and the one in the API
> use different databases, so results may not be exactly the same.
It seems API's database is incomplete. I may have to switch to some
other mechanism/API.
-Arun
>
> --
> Marcelo -http://maps.forum.nu
> --
>
> On Jan 10, 3:22 am, Arun <[email protected]> wrote:
>
> > Trying to create a mashup that grabs all our product success stories
> > and shows the installation locations. The website is at:
>
> >http://blogs.sun.com/stories/resource/maps.jsp
>
> > But GClientGeocoder is not able to geocode most of the locations even
> > though they are valid locations per Google Maps. Moreover it's
> > geocoding random number of sites (7, 8 or 9) each time.
>
> > On the website, "How many plotted" shows the number of locations
> > plotted. If you click on "Plot One" then it tries to plot "Bnei-Brak,
> > Israel". This is a valid location as per Google Maps but
> > GClientGeocoder seems to return "null".
>
> > Any clues ?
>
> > -Arun
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---