Playing With Virtual Earth : Tracking Geocaching Travel Bugs

This has been an awesome week of playing with the interactive Microsoft Virtual Earth SDK and seeing what it can do. I’ve got it working for my work project. As some of you know, I’m into geocaching, and I figured that I’d show you some of the fun I’ve been having with Virtual Earth while giving a glimpse into geocaching.

For my first Virtual Earth demo, I will show you how Virtual Earth works with Google’s KML files. KML files contain coordinates for particular locations on a map. Although KML is a Google format that has been widely embraced by the geocaching community, Microsoft’s Virtual Earth is only recently supporting KML files.

Speedy Travel Bug at Sierra de San Vincente, Toledo, SpainOne of my favorite parts of geocaching is working with travel bugs – items that have been tagged with a tracking number and have goals that involve traveling to a particular location or maybe just traveling in general. As much as I like moving other people’s travel bugs, I also keep track of our three that are out in the wild. Our travel bugs are these little koala keychains that my husband brought back with him from one of his trips to Australia. Since they came from there, I’ve set a couple with the goal to make it to Australia and then come back to the Cleveland area. One has a goal to just see the world.

So I’ve set up Virtual Earth maps to track our three active travel bugs – named for 3 of our chinchillas. You can see my working demo here. Each map is looking at the respective travel bug’s KML feed from geocaching.com.

This is the JavaScript function that I use to get the map:


function GetMap(szMapName, szFeedURL){
var mapTravelBug = new VEMap(szMapName);
mapTravelBug.LoadMap();
mapTravelBug.SetMapMode(VEMapMode.Mode2D);
mapTravelBug.HideDashboard();
var TravelBugPathLayer = new VEShapeLayer();
var veLayerSpec = new VEShapeSourceSpecification
(VEDataType.ImportXML, szFeedURL, TravelBugPathLayer);
mapTravelBug.ImportShapeLayerData(veLayerSpec, onFeedLoad);
}

I pass it the ID of the div that will hold the map and the URL of the KML feed. Since I’m just curious about the path and not getting into altitudes, I explicitly set the map in 2D mode. I use HideDashboard() to make the map controls bar disappear, making the map a bit more readable. Finally, I create a layer for the pushpins and read in the feed. Once I tell the map to import the shape layer data, the pushpin layer is attached to the map.

I was impressed to see that Virtual Earth was able to do basic support of a KML file. One of my personal goals is to do a Silverlight application showing some of my geocaching statistics, using Virtual Earth to show off some of the data, storing the geospatial data in SQL 2008. Maybe I’m a bit too ambitious with new technology, but I think that playing with Virtual Earth for work is going to lead me to that project quicker than I had anticipated.

I look forward to bringing together all of these cool technologies in one application and then showing it off maybe in the next few weeks.

See what happens when you give easily-excitable developers a chance to play with cool toys!

Leave a Reply

Your email address will not be published. Required fields are marked *