MS Space Mobile

Back in late 2005 there was an internal contest sponsored by MED to get people using Compact Framework. I spent a long weekend building a little app to browse Microsoft building floor plans and find offices and conference rooms. I ended up winning some HP PocketPC device with GPS. It was fun!

You have to remember this was before RenderCore or Silverlight Mobile (no XAML - all the anti-aliased rendering was done pixel-by-pixel!) and used good ol’ MapPoint web services for maps and routing and TerraServer for aerial imagery; having been built long before Virtual Earth/Live/Bing Maps.

Here’s the original docs:


Did you know that Microsoft has 426 buildings worldwide? Over 750 floors containing more than 86,400 offices/rooms. This is the equivalent of seven Empire State buildings! MS Space Mobile helps you find your way using your Smartphone or Pocket PC.

Browsing Buildings

From the main screen you have access to the complete database of buildings, floor plans, and office/room information.

welcome browse1 browse2 color buildings

You may filter the building list by country, state/province, city, or campus. Wow, we have a building in Jamaica!

filter_worldwide filter_redmond filter_jamaica

Locate Outlook Contacts

With Outlook integration, you can find a colleague from your contacts and quickly highlight their office on a building blueprint.

contacts blueprint1 blueprint2

Finding Buildings

Finding your way around inside buildings is covered, but if finding the building itself is the problem:

info map map_zoom_scroll
aerial aerial_redwest aerial_redwest_zoom

Technical Details

So how does it work? The main innovation in my mind is the building blueprints. The integration with Outlook, MapPoint and TerraServer makes it nice but those are straight forward.


The building information and blueprints all comes from MS Space Lite and MS Web. They could not easily provide me direct access to the data, so first I built DataScraper:


This is a utility to be run on a desktop machine on CorpNet. It makes 3000+ web requests for HTML pages and SVG, parses them and produces a single buildings.xml files containing all the metadata about each building. It also produces individual XMLs for each building containing the blueprints in a simplified form.

The original data is about 108MB. The XMLs produced are still 20MB.


A second app is responsible for consuming the XMLs produced by DataScraper and converting them to a much tighter binary format. The majority of the data is the vectors for the blueprints - 550,000 points! DataCompressor coverts each building XML to a .bp (blueprint) file. This gets the total data under 3MB and is, I believe, a suitable size for deploying to a Smartphone or Pocket PC.

Ultimately all of these data files are embeded into the MS Space Mobile.exe as resources. The .NET Compact Framework is smart enough only load the individual resource streams into program memory on demand. MS Space Mobile is, in turn, smart enough to only request and persist building data as needed; keeping the overall memory usage under 1MB for the most part.


For the most part it using standard GDI calls. However, CF 2.0 doesn't support the Graphics.SmoothingMode API for anti-aliased vector drawing. For this, we draw the lines with anti-aliasing ourselves pixel-by-pixel in an array of Int32s (32-bit BMP format) and then use Bitmap.LockBits() and Marshal.Copy() the result onto a managed Bitmap. This yields nice looking results. Below, left is without anti-aliasing, middle is with 2/3 pixel wide lines, and right is with 1/3 pixel lines; all at 176 (Smartphone screen) wide. You can see that this makes viewing high-detail blueprints on a tiny display quite usable.


It uses a modified implementation of Xiaolin Wu's anti-aliased line algorithm. The modifications are to handle perfectly vertical/horizontal lines separately (no anti-aliasing) and to handle exactly 45 degree angle lines separately (Wu's algorithm doesn't properly handle). Additionally, we do 'pixel-snapping' so that the line ends are never considered to be within subpixels. You can see the difference below where the left is without snapping and looks blurry and the right is with snapping. This way vertical/horizontal lines look crisp, while angled lines are anti-aliased.


Data Sources

Aerial image service provided by Microsoft TerraServer
Street maps and directions provided by Microsoft MapPoint
Building information and blueprints provided by MS Space Lite