Friday 21 September 2007

Silverlight-map integration progress v0.8

TileClient08 is the latest of my efforts to integrate Silverlight with Virtual Earth/Google Maps. The improvements are all focused on the Earth maps (not Moon/Mars for now).

TileClient08_road TileClient08_satellite

It uses Microsoft Virtual Earth tiles for the 'road' view and Google tiles for the satellite view. The navigation is still a bit clumsy (centering isn't quite there yet), so the best way to give it a try is:

- click one of the city locations (Sydney, New York, London, Tokyo) and navigate around from there (up/down/left/right/in/out)

- click (once!) to set a flag and then zoom in (with the nav-link, or mousewheel). You'll notice the flag/centerpoint "dance around" a bit - just trust that it will try to keep the location in the viewport

- use the Long/Lat/Zoom inputs to go direct to any location on Earth

The slightly odd behaviour is due to the reliance on the tile-grid to lay out the images. Once I have the math worked out to make the grid of images larger (and clipped by) the viewport, it should all work a lot more smoothly. I've also fixed the (previously unknown) IE-bug: you can't treat strings as arrays apparently, so I had to make




for the Virtual Earth tiles to load in IE.

WARNING: I've just noticed (after lots of testing today) that Google's servers will eventually think you're attacking their image server if you download too many tiles too quickly (I wonder if/how Silverlight caches images?).

If you see 'Image not available at this zoom level' always on the earthsat view, Google is probably blocking the images. Click this image link to check - - you'll either see the image, or get a CAPTCHA test... haven't noticed Virtual Earth not serving images (yet...)

WOT: This post was my first using Live Writer... so far so good (although the spacing is a bit whack around the code)

Thursday 13 September 2007

Silverlight, Virtual Earth and Google Moon

Slow progress is being made with tiles from Virtual Earth, Google Moon & Mars, and custom Venus images hosted in a generic Silverlight Map Viewer -- panning kinda works (in addition to zoom)! It's clunky, tile-at-a-time panning (no smooth drag metaphor, yet) but it (mostly) works.

Earth (VirtualEarth tiles)
Moon (Google Maps tiles)
Mars (Google Maps tiles)
Venus (custom tiles)

OK, if you visited the demo you'll know it's not quite done yet... specifically when you zoom in, the zoomed coordinates (row/col) are based on the previous zoom level, so they tend (erroneously) towards the top-left of the map; zooming out sometimes breaks around the edges too... although this is a 'silverlight' project, so far there's only a sprinkling of Xaml - it's mostly math & javascript!

UPDATE: 'earth' view doesn't seem to work in IE. Not sure why... give it a go in Firefox.

Sunday 2 September 2007

Silverlight map control - progress update

Well, the Silverlight map control is coming along slowly...

There has been some progress on calculating the display image tiles, position, etc which is key to enabling proper pan/zoom using - the Moon map now has 'live' coordinate calculations, and very basic up-down-left-right to try.

To get an idea of what the Base4/Binary numbers mean, read about using a Binary Coordinate System and how it is applied in the Virtual Earth tile system (hint: qrts == 0123).

As for the Venus map... doesn't pan yet, but all the images were custom-generated^ using this quadkey map-tile generator. It's only about 100 lines of code, and seems to be limited by the maximum image size
Bitmap resized = new Bitmap(imageSize, imageSize); //16384
All three 'venus maps' were generated using that code.

^ the moon sample currently uses tiles from Google moon.