Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to find a .NET GeoJSON library which I can use to export my SqlServer2008 spatial boundaries (in binary format -> eg. STAsBinary()) from my .NET code to my HTML frontend to display on a google map.

At first I felt that it might be a StackOverflow question, but this site I feel is more specialised to helping me out.

Does anyone know of any?

NOTE: This dll does NOT have to be imported into SqlServer2008. In fact, it will not. I'll use it in my C# MVC WebSite.

share|improve this question

3 Answers 3

The C# bindings for gdal/ogr are always an option. You can create a geometry instance using WKB, and then export to JSON.

http://www.gdal.org/ogr/classOGRGeometry.html

share|improve this answer
    
@user980 - can this WKB data .. which will be transported over the wire as JSON .. be loaded into google maps? –  Pure.Krome Jun 13 '11 at 5:19

If you are using MVC, it is fairly easy to setup a few classes for FeatureCollection, Feature, and then your Geometry type then serialize them using JsonResult. For Json arrays like "features" you can use an arraylist, and for a feature's "properties" use a dictionary with strings for keys and objects for values.

If not MVC, you can do something similar with Json.NET.

Hope that helps, David

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.