I was chatting with a colleague recently and I mentioned I’d been looking closely at the not-yet-released Bing Maps 8 library. My colleague suggested that, in his mind, a Hello World example would be to read lat-lon data from a file, display markers at each lat-lon, and possibly display information about each lat-lon.
So, I created a demo to do just that. My demo reads a comma-delimited text file with four lines of data where each line has a latitude (like 45.50), a longitude (like -122.50), and some arbitrary text associated with the lat-lon.
As each line of the text file is read, a pushpin object is created and saved into an array. Additionally, each pushpin has its default mouseover and mouseout events modified so that an Infobox will be displayed and removed as the user moves the mouse over a pushpin.
There are a ton of interesting details in the little demo. I use one global Infobox object for all pushpins, and just modify the Infobox title and visible properties.
I load the map asynchronously.
I create custom pushpin icons using an HTML5 canvas technique.
All in all, it was an interesting exercise, and the demo revealed strengths and weaknesses of Bing Maps 8.