Thanks so much, its working now. On Tue, Jan 4, 2011 at 12:41 AM, [email protected] <[email protected]>wrote:
> On Jan 3, 11:51 pm, Same dude <[email protected]> wrote: > > So I've got a working version 3 googlemap working that loads its data > > (markers) from xml using an asynchronous jquery call. > > > > Lets say I have a bunch of markers that are added to the map, but I only > > want to show the markers if your zoomed in to a certain point > > on the map. > > > > I would normally handle this with a MVC event that would make the > nonvisble > > markers visible when the mvc events show that the map > > has zoomed in to a certain level. > > Ive done this when I was first experimenting with the API and I wrote out > > each marker by hand and each marker had an individual name. > > > > I was recommended to use asynchronous xml calls to get the data, which I > set > > up. > > I just dont know how to set up a MVC event that can make markers visible > > when it gets to a certain zoom level. > > Before I would know the names of each marker (when i was exerimenting > with > > manually adding markers to a map and creating events for them) > > and could turn each one visible when the map zoom got to a point that I > > wanted > > (by creating an event attached to the MVC and manually turning on the > > markers when the MVC event occured), > > but with the asynch XML method, each one of my markers > > is added through a function that adds them to the map as the xml is > iterated > > through. > > > > in case your confused, heres my function that creates the markers and > adds > > them to the map > > > > { > > //HERE IS THE CODE THAT PARSES THROUGH MY RETURNED XML > > //I LEFT OUT THE PARSING CODE DETAILS > > var name = $(this).find('name').text(); > > var address = $(this).find('address').text(); > > var marker_lat = $(this).find('lat').text(); > > var marker_long = $(this).find('lng').text(); > > var marker = createMarker(marker_lat, marker_long, map); > > > > } > > > > function createMarker(lat, lng, map) > > { > > var latlng = new google.maps.LatLng(lat, lng); > > var marker = new google.maps.Marker( > > { > > position: latlng, > > map: map, > > title: "Hi" > > > > }); > > return marker; > > > > } > > > > I dont know their individual names to attach to the MVC event which would > > turn them visible when the map was zoomed to a specified level. > > Any Ideas on how to tackle this issue? > > Push them into an array (say "gmarkers") as you create them. Iterate > through that array on the zoom changed event, pretending the name of > the marker is gmarkers[i] > > -- Larry > > -- > 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]<google-maps-js-api-v3%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-maps-js-api-v3?hl=en. > > -- 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.
