Is there a silverlight replacement for SqlGeography?
I'm looking for a replacement for Microsoft.SqlServer.Types.SqlGeography that will work in Silverlight. I'm primarily interested in arbitrary collection of data (point, path, or polygon) and the STBuffer, STUnion and STIntersect functionality.
I need to retrieve some geography data from my database via WCF on the middle tier and return it to my silverlight client and let it manipulate the geospatial data there. I mistakenly believed that I would be able to do this with the Microsoft.SqlServer.Types.SqlGeography type. Unfortunately it contains unmanaged code and will not serialize over WCF.
I'm hoping that someone has done this before with more than simply encoding the lat/long into some other format. The thing is that I need to 开发者_StackOverflow中文版perform operations on the data when I return it to the client and don't want to deal with implementing the algorithms for doing this.
Honestly I did not know about SqlGeography types, but I recently created my own lat/lon types (they serialize as comma-separated string). It's rather easy and so are the related algorithms (at least what I needed).
One advantage you have is the full control over serialization where you can do things like trimming "unused" decimals in order to reduce the web service payload.
In the end, I ended up implementing the strictest set of functionality that I possibly could.
精彩评论