0

I'm almost finished with Pset8 (Yes!). My text boxes, info window and articles are all showing.

The only remaining issue I have is that when opening my InfoWindow. When I click on certain marker, I would sometimes open infowindow on a previously clicked marker. For example, clicking on "Atlanta, GA" opens up an infowindow on top of Atlanta, GA with articles. Then, clicking on "Decatur, GA" would still open up the infowindow on top of "Atlanta, Ga" though the articles have changed to be those for Decatur, GA. Comparing mine and the staff's solutions, we have the same markers and articles appearing.

Reading the code, I have no idea why this would be the case. I'm thinking my articles variables is passed in correctly into the showInfo function, but somehow not the marker variable? On the other hand, my markers exactly match those of the staff solution so I don't know how that would be the case.

Here is part of my code declaring marker and passing it into the showInfo function. Any help would be greatly appreciated

marker = new MarkerWithLabel({
        position: myLatLng,
        map: map,
        draggable: false,
        labelContent: labelcontents,
        labelAnchor: new google.maps.Point(25, 0),
        labelClass: "label", // the CSS class for the label
    });

    //code to add articles

google.maps.event.addListener(marker, 'click', function() 
        {
            showInfo(marker, articles);
        });
0

If that's your last problem, then I think that you are finished! Think about the real-world practical application of what's happening and not the code.

The clue is that you clicked on two cities that are only 8 miles apart! The mechanism is going to search for news articles relative to the general geographic area around the marker. Since the two markers/cities are so close to each other, they probably have all the same news outlets and they're almost certainly going to produce identical results. I would think that only if some story were truly local to the smaller metro area, Decatur, it would show up there and not in much larger Atlanta.

As the distance increases, two markers may show some common results, especially around a large metro area like Atlanta. You might get different results for two markers close together, but with a state border between them, but I haven't tested that.

Now, if you were getting the same results for two cities like Los Angeles and Chicago, I'd be worried, but I'm sure that's not the case. ;-)

Congratulations! Time to do your project!

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .