Also a gotcha I forgot about the free maps api doesn't allow you to geocode more than 15,000 per day per domain (premium does) so if you're DB is big and you're looking up more addresses than that it could be a problem (even if it does 1000 look ups that means 15 people could visit your site and then kaput), also as Trevor posted if the addresses don't change often it's probably best to just do some sort of batch or cron job to do the geocoding once (or even on insertion) then store the results in your db so you don't need to look them up again, if this violates some rules sorry I suggested it but if not it seems like a reasonable plan. Good luck, Shaun
On Sep 25, 2:59 pm, Shaun <[email protected]> wrote: > Came back to this one a few times cause I wasn't understanding the > problem with it being asynchronous but I think I get what you're > saying now so you have a listener that handles the geocoding results > but you fire to geocode a whole group of things at one time rather > than sending them one by one. So the problem is you're loop is > calling geocode many times and you're getting results back out of > order and probably trying to associate them with you're posto variable > or something like that... what I'm thinking you need to do is have a > counter that is at the class level so it is in scope between the > result handler and the method you have here that does the > geocoder.geocode then increment the counter each time the handler gets > hit and make a call to this method (or a new one, you may need to > separate out this functionality) so essentially you're adding some > synchronization to something that is asychronous normally, this way > you're order is maintained because you request one you get one back > you move on to requesting the next one so you will never request the > next one before the current one is processed. Hopefully some of this > makes sense, or else I may be completely misinterpreting you're > problem, if so and its still an issue please explain more throughly or > post more code (for example I don't know what returnedColl is I'm > assuming it's you're data from the database but it took some effort to > figure this out... in short I'm lazy explain more and I can think > less :). > Good luck, > Shaun > > On Sep 22, 4:04 pm, Marcelovs <[email protected]> wrote: > > > > > Hi people, > > I have a problem. > > > I'm develloping an application that contains many addresses in my > > database and I need to search this addresses in google maps. > > I'm sure the addresses are right, because when I search one by one, > > The google map finds it, but when I search many addresses they doesn't > > work correctly. > > I know this method - ClientGeocode.geocode - is asynchronous this > > situation occurs because of this, but I don't know how to solve it. > > > It's part of my code: > > > googleMap.clearOverlays(); > > > var returnedColl:ArrayCollection = ArrayCollection > > (event.message.body); > > > var lObject:PostoVO = null; > > for(var i: int; i< returnedColl.length; i++){ > > lObject = PostoVO(returnedColl[i]); > > geocoder.geocode(lPosto.address); > > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API For Flash" 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-for-flash?hl=en -~----------~----~----~----~------~----~------~--~---
