In the current version of the code, should the variable 'iter' be local to each instance of doGeocode, which in turn should make it local to each call back?
If so, why would mgr.refresh be called multiple times? If you load my page with several points you can see the map is refreshed multiple times. http://sharepoint.advancedtelesystems.com/public/Downloads/MapIntegration.html?address=1%20hathaway%20st%20providence%20ri%2002907&title=1&address=1%20amana%20dr%20johnston%20ri&title=1e&address=1%20teakwood%20dr%20coventry%20ri&title=1%20title&address=1%20intitute%20rd%20worcester%20ma&title=1&address=1%20broad%20st%20proidence%20ri&title=1&address=1%20south%20st%20johnston%20ri&title=1&address=1%20terry%20ln%20chepachet%20ri&title=1%202 On Jun 30, 7:28 am, jayjayc <[email protected]> wrote: > Thanks, > I will try that. > > On Jun 30, 12:03 am, "[email protected]" <[email protected]> > wrote: > > > > > On Jun 29, 8:31 pm, jayjayc <[email protected]> wrote: > > > > I have updated the code to add some more features, and to make it more > > > reliable. The geocoder now runs in a seperate function with local > > > variables, so now I can accuratly label the tool tips for each marker. > > > > The problem I have now is an expected one, when trying to map multiple > > > points (>5) occasionally some of the markers do not display. > > > > For instance, if you go to the follow page and keep hitting refresh, > > > sometimes some of the points will not > > > display:http://sharepoint.advancedtelesystems.com/public/Downloads/MapIntegra... > > > title&address1=5 institute rd worcester ma&title1=test title > > > 1&address2=10 teakwood dr coventry ri&title2=test title2&address3=92 > > > broad st providence ri&title3=test title 3&address4=7 tiogue ave > > > coventry ri&title4=test title 4 > > > > Since performance is not really a factor here, is there something I > > > can do to ensure that all the points load even if it takes several > > > seconds? > > > > I understand the limitation with the geocoder, can someone help > > > You need to add error handling to the geocoder. The .getLatLng method > > doesn't return and error code, it returns null and doesn't tell you > > why. The .getLocations method will return multiple locations (the > > first of which is the one that would have been returned by .getLatLng) > > and an error code. If you get a TOO_MANY_QUERIES error code, delay > > for some period of time, then try again. A couple of examples from > > Mike Williams' tutorial: > > Part 16 Geocoding with error handlinghttp://econym.org.uk/gmap/geo.htm > > and > > Part 17 Geocoding multiple addresseshttp://econym.org.uk/gmap/geomulti.htm > > > -- Larry > > > > On Jun 29, 4:33 pm, jayjayc <[email protected]> wrote: > > > > > Thank you all for the replys. > > > > > I updated the code to include a check to verify the last point has > > > > been coded, as suggested by Andrew. It appears to be working. I have > > > > only tested it with 6 locations, and it is working. I may include a > > > > little message that says something like 'points loading'. > > > > > I am aware that this is not the best method for a large number of > > > > points. I plan on adding some code that will cache the long and lats > > > > for future use. Currently the most this would need to handle is > > > > around 15. I plan to use the HTTP geocoder to load the position > > > > information of a site the first time a user opens the database entry. > > > > This should put off the load over time. Unfortunately I dont really > > > > know how to use JSON information, but I will eventually find out. > > > > > On Jun 29, 3:29 pm, Andrew C Leach <[email protected]> wrote: > > > > > > On 29 June 2010 19:31, jayjayc <[email protected]> wrote: > > > > > > > I am trying to geocode a couple of addresses passed by a url and use > > > > > > the MarkerManager to display them. > > > > > > > My map will center around the location, but will not place the > > > > > > marker(s). > > > > > > > Here is a copy with a single address as an example: > > > > > >http://sharepoint.advancedtelesystems.com/public/Downloads/MapIntegra... > > > > > > This is because the geocoder is asynchronous. > > > > > > The map is centred because the callback function does that when it > > > > > gets the point and pushes the marker on to the array. > > > > > > However, the "batch" array is added to the marker manager before the > > > > > callback function has been called, so at that point it's empty. When > > > > > the geocode result is returned, the map is centred and the marker is > > > > > pushed on to the array; but then nothing else happens to the array. > > > > > > You need to ensure that everything which needs to happen to geocoder > > > > > data happens within the callback function. > > > > > > Since you know the length of arr2, you could include a test in your > > > > > loop and only action the centring and marker-adding when you're done: > > > > > > if (i==arr2.length-1) { > > > > > gmap.setCenter(point); > > > > > mgr.addMarkers(batch, 13); > > > > > mgr.refresh(); > > > > > } > > > > > > ...but all that needs to go into the callback function, so every time > > > > > a result is processed, the code asks "Is this the last one to come > > > > > back?" and finishes the map if it is.- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text - -- 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.
