Hi lynxmap- Due to the way our quota system works, you can't just geocode many addresses in a tight loop. On top of that, I wouldn't recommend geocoding multiple addresses (especially 200) every time a map loads - that is slow and a bad experience for the user. If you already know the addresses, you should use the HTTP geocoder to geocode them ahead of time.
Either way, Mike Williams has written up a nice page that talks about this: http://econym.org.uk/gmap/geomulti.htm His page is about the JS API, but the concepts apply to the Flash API as well. - pamela On Mon, Feb 23, 2009 at 6:22 PM, [email protected] <[email protected]> wrote: > > Not sure what I am doing wrong. Trying to geocode about 200 points in > a loop routine, but every one comes back as a geocode failure. I'm > using Flex Builder 3. > > Here's my code: > var count:int=0; > private function tryGeocode(pt:ptVO):void{ > var listingAddress:String=pt.Address; > var wordCounter:RegExp=new RegExp("[^\ ^\t^\n]+","g"); > var arrayCount:Array=ptAddress.match(wordCounter); > if (arrayCount.length>1){ > var geocoder:ClientGeocoder = new ClientGeocoder( > new ClientGeocoderOptions({viewport: LaPlataBnds })); > > geocoder.addEventListener(GeocodingEvent.GEOCODING_SUCCESS, > > function(e:GeocodingEvent):void{onGeocode(e,pt);}); > //trace for failures: > > geocoder.addEventListener(GeocodingEvent.GEOCODING_FAILURE, > > function(event:GeocodingEvent):void{trace("GEOCODE FAILURE: > "+ptAddress);}); > //add 'Colorado' if not already there: > ptAddress=ptAddress + " , Colorado"; > geocoder.geocode(ptAddress); > }//end if address wordcount> 1 > } > > private function onGeocode(event:GeocodingEvent, pt:ptVO):void{ > var thisGeocode:Object=event.response.placemarks[0]; //geocode info > (address, point, etc) > var newPt:LatLng=thisGeocode.point; > if (LaPlataBnds.containsLatLng(newPt)){ > count+=1; > pt.mappedBy="geocode"; > pt.ll=newPt; > }//end if Bnds > }//end onGeocode > > I get a long list of failures like this: > [SWF] /mapsapi/publicapi/geo - 754 bytes after decompression > GEOCODE FAILURE: 750 Main Avenue Durango , Colorado > [SWF] /mapsapi/publicapi/geo - 760 bytes after decompression > [SWF] /mapsapi/publicapi/geo - 758 bytes after decompression > [SWF] /mapsapi/publicapi/geo - 751 bytes after decompression > GEOCODE FAILURE: 12161 CR 240 Durango , Colorado > GEOCODE FAILURE: 590 Glacier Club Dr Durango , Colorado > GEOCODE FAILURE: 582 Animas View Drive Durango , Colorado > [SWF] /mapsapi/publicapi/geo - 760 bytes after decompression > > Is it because I am trying to do geocodes too frequently? As I > mentioned, this gets called about 200 times by a for next loop. > > ????? > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
