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/MapIntegration.html?address0=2%20hathaway%20st%20providence%20ri%2002907&title0=test 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 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 - -- 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.
