A couple of days ago I posted about a slide-deck which contains the current coverage with Bird’s Eye images in EMEA and APAC. In the meantime I also published a Virtual Earth mash-up which provides a tile-layer for the coverage and database access to retrieve the regions we have by country. A flag near the region will show you what we have recently updated or added.
Do you want to know how I created this mashup? Oh really? It is a long story and it involves some beautiful software-previews I could get hold of.
The basic idea I had was, that I not only wanted to know the region where we have coverage, I wanted to know the exact extends of those areas. For example if we claim to have Bird’s Eye coverage for London it is actually a much bigger area but if we look at Madrid it is a relatively small area in the north of the city center. My first idea was to use the Virtual Earth method GetBirdseyeScene() to determine if there is an Bird’s Eye image or not. Well, the challenge is that I have to do that on every tile and there are quite a lot. The Virtual Earth tile-system is based on a quadkey. Joe Schwarz has explained that excellently in an article on MSDN.
Of course I can reduce the number of roundtrips by selecting a lower zoom-level. To use the function GetBirdseyeScene() I have to be at a minimum zoom-level of 13 and I figured that level 14 might be a good compromise between accuracy and number of roundtrips but hey there are still almost 270 million tiles at this level if you look at the whole world.
|Zoom-Level||Number of Tiles|
Let’s stay with that figure for a while. If we have 270 million tiles and I need to make a thorough check by positioning the map and then executing this GetBirdseyeScene()-method. Let’s assume it takes me 1 second each. In that case I have 2 seconds for each tile which would at level 14 add up to almost 540 million seconds or 17 years in a single-threaded process. I didn’t really want to wait that long :-).
So, the most important task was to reduce the area in which I have to perform these checks. Our data-provider Blom was kind enough to send me an ESRI Shape-file with the regions they have completed or currently work on. Unfortunately these regions may not be exactly what we have already published so I couldn’t overlay these data directly but I had a good starting point to narrow down the search area. How do I have to go on from here?
- I have to load and validate the date.
- I have to determine which tiles – i.e. which quadkeys – are within those region.
- Then I move the map to the center-point of these tiles and execute the GetBirdseyeScene()-method for these locations.
- If we have a Bird’s Eye image I create a colored PNG-image which matches the name (quadkey) and the size (256 x 256) pixels of the Virtual Earth tiles.
- Once I have completed that for level 14 I use some GDI classes to create the tiles for lower zoom-levels.
- Finally I create my mashup which overlays these tiles as tile-layer on Virtual Earth.