ThinkGeo.com    |     Documentation    |     Premium Support

Moving Markers

Hi.


I am trying to simulate moving devices for tracking purposes.  Have created markers using the InMemoryMarkerOverlay layer.  What I want to do is be able to move the marker feature(s) on the map (at the server code)  but do not see how to do this.  I am using markers to represent the objects as I need/want the popup/contextmenu capabilities. 


Please let me know.


 



Tony,


 Here is a sample for you showing how to implement it. There are 2 aspx files in the sample, one is only using Server side code and the other also uses client part javascript. In both aspx, the marker will be refreshed every second but you can tell the one using javascript definitely gets better performance, that’s the way we recommended.


Ben



155-Post4905ForTony.zip (95.3 KB)

Hi Ben,


Saw your attached .ZIP to move points using AJAX Timer, map placed inside an UpdatePanel. I tried that, but the problem is that for every tick of the timer, the map flickers. Please tell me how to solve this flickering problem?


 


 



Ric, 
  
 There are 2 aspx files in the sample. The 1st one (DefaultByJavascript.aspx) has better performance without any map flicker. The 2nd one (Default.aspx) only uses server side code and during every post back, UpdatePanel will refresh and map might flick. For the 2nd case, map flickers in FireFox while not in IE7. 
  
 Can you let me know which sample and which browser you are using?  
  
 Ben 


I noticed an apparent bug with this demo in that if you zoom out, the latitude of the marker drops significantly.  In fact, when you zoom all the way out, the marker is completely below the United States.  As you zoom in, it moves higher and higher.  Obviously, this won’t work!  Is there a fix for this? 
  
 Thanks, 
 Ken

Hi Ken,



You find the trick but it’s not a bug in Web Edition. The default center of marker is UpperLeft of it, you need to set its offset to make the center to the BottomCenter. Please add the following style to the code you are using and it works fine.

markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage.ImageOffsetX = -10.5f;
markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage.ImageOffsetY = -25f;

Any questions please let me know.



Thanks,



Howard