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

quadkey[quadkey.length-1]


into



quadkey.charAt(quadkey.length-1)


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 - http://kh0.google.com/kh?n=404&v=20&t=tsrrtsqrssqqtts - 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)

2 comments:

  1. could you please give me the code for this tileclient silverlight example. I am able to display the virtaul earth map into silverlight but dont know how to use quadkey's and zooming. Please send me the code to ramanaiah97@gmail.com

    Thanks in advance

    ReplyDelete
  2. Where does it say this code is 'open source' and available for anyone to use?

    There is plenty of info on MSDN if you want to learn about the data structures.

    Good luck!

    ReplyDelete

Note: only a member of this blog may post a comment.