On Jul 13, 10:46 am, Tijmen <[email protected]> wrote: > If you look on this page (http://tijmensmit.com/gmap/xml.php), and > select New Zealand and set the date from 07/01/2011 till 07/31/2011 > two markers will show up. But if you look at the output in the console > in firebug, you can see that there are actually 3 markers. There are > duplicate ones for the bottom one in Nelson. > > What I would like to do is add the content from the duplicate > infowindow to the existing infowindow of the marker that already > exists on the same spot. What happens now if you click on the marker > is that you will see who is present in a country between the selected > dates. Eventually you get more then 1 person in the some location, so > to me it makes sense to add them the the already existing infowindow > and eventually show a list of people. > > The problem is that I don't know how to get that to work, and if its > even possible. > > I have the check working for duplicate markers, and it does raise the > alert when a duplicate position is found, but I'm unable get the > content of the current or duplicate marker. I tried different > combinations with the getContent function, the code below is the last > attempt. > > if (markers[i].getPosition().equals(marker.getPosition())) { > // alert('duplicate found'); > //alert(markers[i].getContent()); > > } > > Is it even possible to do what I want?
Yes. I would suggest doing it server side though as sending the information to the client and having the client do the processing while the user is waiting will be less efficient and less user friendly. You should be able to detect the duplicate entry when it is entered in the database as opposed to looking through all the locations for duplicates when they are displayed. To do it in the client you would need to: 1. pre-process the json to detect duplicates and create the html for the markers before creating them. or 2. change your mechanism for associating the html with the marker (currently you are using a function closure, you would want to store it somewhere accessible, like in an array) -- Larry > Or is there a better way to > filter out duplicate markers and add the content from the duplicate > one to the existing one? Also, would it be better to check for > duplicates in php, before building the json output, or do it just > before putting the markers on the map? > > Thanks :) -- 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.
