http://theamazingalbumcoveratlas.org/
The excellent Word Magazine recently created an album cover atlas which shows locations of famous album covers. Cool idea, but I didn't like the basic google maps interface.
So as an exercise and to also help spike out some work we are doing on www.lovecleanstreets.org I created a quick Virtual Earth and Silverlight version that make use of the VIEWS VE managed wrapper for Silverlight.
Luckily the original developer, Ian Reeves used a REST service to get the data, so I was able to work with the same live data for my project. There was no cross-domain policy that could be used by Silverlight though, so I created a WCF bridge service instead on my web project and referenced that from the Silverlight project:
[OperationContract()]
public List<AlbumCover> GetAlbums()
{
const string rootUrl = "http://www.wordmagazine.co.uk/album_atlas/";
WebClient client = new WebClient();
string result= client.DownloadString(rootUrl + "xmlGeneratorAlbums.php");
XDocument data = XDocument.Parse(result);
IEnumerable<AlbumCover> albums = from cover in data.Elements("albumcovers").Elements()
where cover.Attribute("ident").Value != "1"
select new AlbumCover {
Ident = SafeIntParse(cover.Attribute("ident").Value),
Album = cover.Attribute("album").Value,
Latitude = SafeDoubleParse(cover.Attribute("latitude").Value),
Longitude = SafeDoubleParse(cover.Attribute("longitude").Value),
Artist=cover.Attribute("artist").Value,
Link=cover.Attribute("link").Value,
AddedBy=cover.Attribute("addedby").Value,
Details=cover.Attribute("details").Value,
Location=cover.Attribute("location").Value,
ImageUrl=rootUrl
+ "getimage.php?ident="
+ SafeIntParse(cover.Attribute("ident").Value) };
return albums.ToList();
}
This worked fine on the development server, but I hit an issue when it was hosted on IIS. The service threw an exception: "This collection already contains an address with scheme http" - turns out this is an issue if you have more than one host header with the Wcf service. The solution is to write a custom host factory as described here by DiscountAsp support (we are not using DiscountAsp - but this is a good explanation that will work with any hoster)
Another issue I came across was to do with the images. There are already over 400 album covers in the database, and I thought it would be nice to store those in Isolated Storage for fast re-use - unfortunately although you can serialise the data into isolated storage, there does not currently seem to be a way to get the Silverlight Image control to display them (you can't create an image from a stream - only from a Uri), so I have had to rely on browser caching instead.
Source code is available below, and offers no guarantee of anything but might be worth a look if you are trying this sort of thing.
Cheers
Ian