Useful for rendering a raster tile map on WP?

Jan 10, 2012 at 9:20 PM

Hi,

I found this project and it is very impressive.

I want to create a map control like the bing map control on Windows Phone. The map is composed of several tiles (256*256px), for example from openstreetmap. Of course it should be possible to pan, zoom etc the map smoothly.

I have seen some approaches where a canvas and one rectangle per maptile were used. The rectangles are filled with the maptiles with an imagebrush and then the rectangles are arranged on the canvas. I'm not experienced in Silverlight, I'm coming from the windows forms world but to me this way seems to be not very efficient and clean.

Now I found this library and to me it looks much cleaner using an image control, a writeablebitmap and blitting the 256*256px tiles to the writeablebitmap.

But now the most important question is: How will it perform? Will it perform better or worse or similar? Smooth panning and zooming is very important, also later on there will be additional layers like tracks, pins etc drawn on top of the map. Rotating the map is not neccesarily needed but would be a nice addon if it was possible...

Or should I go for XNA for this purpose?

 

Thanks in advance for any answers.

Coordinator
Jan 11, 2012 at 8:12 AM

Good question. You will need to measure it to be sure, but in general XNA should be faster depending on the platform you're targeting. XNA uses the GPU for rendering, whereas Silverlight runs on the CPU. You can also enable nice 3D scenarios with XNA and real 3D rendering later.

You might also want to look into this project which uses WriteableBitmapEx for tiling http://silvermap.codeplex.com/

 

- René Schulte

Jan 11, 2012 at 11:07 AM

Thanks for your quick answer.

Yes, XNA will probably offer the most possibilities, But since I only need to render an image composed of several smaller .png images without any 3D processing I was hoping that  I don't need to learn XNA and switching the whole application to XNA (not sure if I can combine Silverlight and XNA in one app)

Apart from XNA, From your experience what do you think about the usage of a canvas with several rectangle (or images) on it? Does it possibly perform better than using a writablebitmapex?

Thanks

Coordinator
Jan 11, 2012 at 12:00 PM

No. WriteableBitmap with Blitting is faster, that's why so many use it for this purpose. See the linked project above.

Since Windows Phone 7.5 (7.1 SDK) you can make hybrid Silverlight and XNA apps. I'd recommend to use this approach and stick with XNA for map visualization. 

 

- René Schulte

Jan 11, 2012 at 1:43 PM

Ok, I thought that writableBitmap would be faster. I was just not 100% sure because as I understood from MSDN Silverlight for WP can let the GPU / composition Thread handle some work and caching when using Silverlight shapes while writablebitmap won't do that...right?
Anyway, I will have to read some XNA tutorials to see if I can use it in a simple way for my purpose. But most likely I will try out writablebitmapex first.

Thanks again