During my Virtual Earth Workshop at the GIS-T (www.gis-t.org) conference, I demo’d how to execute a spatial query in a VE scenario by using JavaScript, WCF, and SQL Server 2008. The query returned GeoRSS to the browser so the VE map control could use it to draw polygons on the map. I ingested the spatial data into SQL from ESRI shape files provided by the US Census Bureau here using a free tool available here. I’m planning on cleaning up the code, making the sample available, and recording a channel 9 screencast explaining the sample. As a result of the demo, I received the following email from one of the attendees:
"I would like to know if you have a demo of how I could store the coordinates created by generating points or polylines from on the map into a database. You can save them as part of collections but I would like to know how they can be stored into a database."
I do not have such a sample. However, Johannes Kebeck, has a sweet series of posts around Virtual Earth & SQL Server 2008:
Virtual Earth & SQL Server 2008 – Part 1: Introduction (1/2)
Virtual Earth & SQL Server 2008 – Part 1: Introduction (2/2)
Virtual Earth & SQL Server 2008 – Part 2: Spatial Data Management in SQL Server 2008 (1/3)
Virtual Earth & SQL Server 2008 – Part 2: Spatial Data Management in SQL Server 2008 (2/3)
Virtual Earth & SQL Server 2008 – Part 2: Spatial Data Management in SQL Server 2008 (3/3)
Virtual Earth & SQL Server 2008 – Part 3: Getting Started with Virtual Earth
Virtual Earth & SQL Server 2008 – Part 4: Integrating SQL Server 2008 and Virtual Earth (1/6)
Virtual Earth & SQL Server 2008 – Part 4: Integrating SQL Server 2008 and Virtual Earth (2/6)
Virtual Earth & SQL Server 2008 – Part 4: Integrating SQL Server 2008 and Virtual Earth (3/6)
Virtual Earth & SQL Server 2008 – Part 4: Integrating SQL Server 2008 and Virtual Earth (4/6)
Virtual Earth & SQL Server 2008 – Part 4: Integrating SQL Server 2008 and Virtual Earth (5/6)
Virtual Earth & SQL Server 2008 – Part 4: Integrating SQL Server 2008 and Virtual Earth (6/6)
Virtual Earth & SQL Server 2008 – Part 5: Conclusion
Part 4 (6/6) is titled Inserting Data into SQL Server 2008 and answers the question. However, Johannes takes a slightly different approach than the pattern I showed in my demo. I love the fact that he took a fairly platform agnostic approach in his examples because it means that anyone can use the approach regardless of their client & server libraries. However, I’m a .NET evangelist. It’s my job to highlight our great developer platform. We have some great libraries and APIs in the Microsoft AJAX Library / ASP.NET AJAX & the Windows Communication Foundation that could help make building out this scenario much easier. I plan on taking the same scenario and building it out using them. I’ll be working on it, along with my original example, in the next week or so. When I am done, I will make the source code available and have 2 screencasts walking showing how to build them step by step.