Following a moving object on Virtual Earth

by Jeff Email

Link: http://totusterra.com/VESamples/FlyBy/flyby.htm

Today's cool little demo is using Virtual Earth to track a moving object, keeping that object at the middle of the screen and then moving the map around it.

Follow up:

I won't go into as much gory detail this time around, since the process is fairly straightforward.

  1. Have a telemetry source or something else that tells you where the object in question is.
  2. Use setInterval() or setTimeout() to get the latest position and update the screen on a regular basis
  3. Use the Virtual Earth PanToLatLong() function to scroll the map to follow the telemetry.
  4. Put an icon at the center of the map to represent the object. Since it never has to move, I went with a just putting the icon over the center of the map in the form of a Virtual Earth Control.
  5. For added effect, I made the icon rotate to follow the direction of travel & leave a trail behind so we could follow where the object went.

And that's it. Ok, maybe it wasn't that easy, but it wasn't very difficult either.

Check out the demo, look at the source code, and you'll be flying in no time.