Certainly that's good advice, but these locations are actually dynamic (or will be in the final version). The locations will be coming from a frequently changing database, so I'll need to be doing the geocoding.
I think there's a problem with the programming though, and I think it is related to the Javascript closure. On Jul 13, 9:19 am, "[email protected]" <[email protected]> wrote: > On Jul 13, 5:43 am, moderntymes <[email protected]> wrote: > > > > > > > I'm trying to create a map with approximately 40 markers. Each marker > > is geocoded and has an event handler for 'clicked' that redirects to a > > new page. I've pretty much used the geocoding code straight from the > > Google API v3 site, but the code fails if I add more than 10 markers. > > On the 11th, I get a Javascript error. If I try to show more than 11, > > then all the markers disappear. > > > I receive a rather useless (to me at least) error message: '0' is null > > or not an object. > > > If I take out the event handler, the problem remains so it seems to be > > connected to the geocoding. I think it has something to do with these > > lines: > > geocoder13.geocode( { 'address': '6059 S Seneca,Wichita,KS,67217'}, > > function(results, status) { > > var marker13 = new google.maps.Marker({ > > map: map, > > position: results[0].geometry.location, > > title:"Cox Farm" > > }); > > }); > > > In particular, if I remove the stuff after function(results, status) > > { up to the next }, I don't get an error. Of course I also don't get > > any markers! > > > I tried with each geocoding occurence listed separately, which you can > > see here:http://cornmaze.moderntymes.com/map.htm > > > I also tried making a function to do the geocoding > > here:http://cornmaze.moderntymes.com/map_testgc.htm > > > Results are the same either way. > > The general advice is not to geocode addresses everytime your page > loads. Geocode them once, offline, then use the resulting coordinates > to display the markers. > > Geocoding the addresses every time wastes google's resources, so they > have implemented rate limits and quotas. You should only geocode > addresses you don't know in advance (like user input) on the fly. > > -- Larry- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
