This project is read-only.

Rendering custom data

May 13, 2009 at 3:29 PM



I want to render my own spatial data (vector (shp, shx & dbf files) and raster (sid & sdw files)) on top of the virtual earth silverlight map control or DeepEarth control(by supressing the default maps, this can be achived by changing the mode).

I found a link where we can render the custom spatial data from files in virtual earth in 2.0 (not in silverlight edition) using a library from SharpMap.

I could not refer that library in my silverlight application because the library was not built for silvelright runtime. Is it possible to write a WCF service which refer the library and expose a method (called by silverlight) to return the map data that can be rendered on top of the virtual earth default map.

Note: I already have a WCF service where silverlight application register for updates from the WCF service through callbacks. I can make use of the same WCF service that can read the spatial data using the SharpMap library and return the map data to silverlight application.

Few questions:

1. Do we have any ready to use library to read the spatial data for silverlight map control? so that the rendering logic & the data can be put at client side instead of server side. Is it a good approach?
2. Whats the best way to render custom spatial data in silverlight map control?


May 26, 2009 at 6:03 PM

Hi there,

I don't know if there is any library that is readily available to suite your requirement. But you should be able to easily customize SharpMap to parse the shapefiles and return the information you need from the shapefile to render it on the client. This is what exactly I did.


I don't think it's good idea to put the rendering logic on the client side unless you render user specific maps. Even then, I would rather do it on the server so that I will have control on the resources I can put to render the map.

May 29, 2009 at 4:41 PM
Edited May 29, 2009 at 4:43 PM

Hi thanga,

I have a question for you, How do you think it is a better to render the map in server not in client? for example, If the end user just query very simple feature, I am wondering if it is a good idea just rendering in the client? (you can get the data of the feature over web services hosted by sql server spatial, drawing it dynamically)




May 29, 2009 at 6:38 PM

if you have small number of features like store locations etc, it's ok to render on the client side. If you need to render complex polygons and large in quantity, rendering on the server side will help you to reduce the network traffic. Think about rendering 100 zip code boundaries on the map.



May 29, 2009 at 10:19 PM
Edited May 30, 2009 at 1:04 AM

It's a good point, Thanks. If the data were loaded to the client, you should not have to retrive data anymore.

May 30, 2009 at 1:25 AM

I'm about to make some announcements here that will help. Loading the shapefile locally is such a good scenario since you don't have to send all the data to and from the server (unless you want to!)

What we have planned is a generic interface for serializing vector data on the map. I have been build an implimentation for GML as it is easy to read and very powerful when hooked upto SQL2008 native geography data type. So, although it has yet to be made, the way forward to support local shapefiles would be to impliment this interface, maybe just the "From" to begin with. I can provide some links to .net code to help with this also.

The other solution is if you import your data into SQL2008 then we can show it today, this demo for example: 


Jun 1, 2009 at 6:37 PM
Edited Jun 1, 2009 at 7:10 PM

Hi John,

That's very nice. "reduce" method is great way to reduce the unnecessary vector point data, It is the excellent way of RIA principle. either "tiles" or "vector" works for the project, How do you balance between them?

Thanks in advance,


Jun 2, 2009 at 3:08 AM

As part of the upcomming restructure here I'm setting up a sub project to deal with prototyping this. Initially I want to break the data into 4 reduced sets, Zoom 1->8, 9->14, 15->18, 19+. This will start as only vectors but if you have ever watched the live labs photosynth demo from TED you will see they produced a raster to show quickly before seemless changing to the vector.

Stay tuned as I'm going to start a thread to hopefully get people interested in making a good open source working prototype here.


Jun 4, 2009 at 6:21 PM
Edited Jun 4, 2009 at 10:01 PM

It is an excellent idea to use different sets. 3D is very interesting, "Raster image" is more powerful than "Vector" in the case (but the images has to be generated and sent to client). "Raster" could be better if there were no any change in the layer, but......, I do not know if "writeablebitmap" works for the change of "Raster"... any idea?



Nov 4, 2009 at 5:28 AM


There is a good source here My company have successfully changed this to silverlight. Sorry that I cannot divulge the source, as it is my company's property. Just that it can be done :)




Nov 5, 2009 at 11:06 AM

We have quite complex shapefiles converted to OQC geometries stored in SQL2008 rendering pretty well now. The nettopologysuite provided the simplication algorithms on the client side.

Unfortuneatly we never got the shapefile reader to work in pure silverlight as their are no database drivers to read the dbase files. Silverlight was never designed to read directly from a database.

I have do have an awesome demo of render all the countries in the world that runs pretty well, I will post this up as a key example for our upcomming release with full source code.

Nov 5, 2009 at 12:46 PM

Yes, but Silverlight can get data through webservices. What was done is that the dbase was converted to MSSQL. The rest is straightforward conversion from WPF to Silverlight which shouldn't be too complicated.

Anyway, I look forward to your demo. It is definitely very interesting.