Search the web
Sign In
New User? Sign Up
yws-maps · Yahoo! Maps Developer Community
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Refreshing Map Markers   Message List  
Reply | Forward Message #7192 of 7224 |
I have a page that displays a map with several markers (say 10) using the Yahoo
AJAX API. Every once in a while (say once an hour), I want to change the status
of the markers (i.e. change the icon and text) based on input from a JSON data
source.

Currently, the web page draws all the markers nicely, but when I later try to
change the markers, I run into 2 issues:

1) "map.removeMarkersAll();" does not seem to remove any of the existing markers

2) when I try to put new markers up, they always appear stacked up in the upper
left corner of the map (no matter what zoom level or map position).

I am drawing the markers with something like:
var myImage = new YImage();
myImage.src = 'img/MapIcons/point_1.png';
myImage.size = new YSize(48,48);
myImage.offsetSmartWindow = new YCoordPoint(24, 0);

var msg = 'some message';
var newMarker= new YMarker(new YGeoPoint(lat, lng), myImage);

newMarker.addAutoExpand( msg);
var markerMarkup = msg;
YEvent.Capture(newMarker, EventsList.MouseClick,
function(){
newMarker.openSmartWindow(markerMarkup);
});

map.addOverlay(newMarker);


Does anyone have any ideas on a good way to refresh the markers?

Thanks,

Mark Bentley




Mon Jul 6, 2009 8:17 pm

mark_j_bentley
Offline Offline
Send Email Send Email

Forward
Message #7192 of 7224 |
Expand Messages Author Sort by Date

I have a page that displays a map with several markers (say 10) using the Yahoo AJAX API. Every once in a while (say once an hour), I want to change the...
mark_j_bentley
Offline Send Email
Jul 10, 2009
4:39 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help