Last post Feb 03, 2014 03:40 AM by Ben Grice
Jan 29, 2014 10:03 AM|Ben Grice|LINK
We have a SQL Server 2008 R2 table containing spatial (geometry) data. We'd like to produce a Web API service which would allow this table to be read/updated. We'd like to use QGIS to view/update the spatial data, but QGIS will only accept GeoJSON via
a web service. Can somebody point us in the right direction as to how to generate GeoJSON via a Web API?
I originally posted this here
http://social.msdn.microsoft.com/Forums/vstudio/en-US/c83ac617-1aee-44ea-aa99-5e53097171ac/geojson-webapi?forum=csharpgeneral but was requested to post this elsewhere.
Thanks in advance for any assistance
Jan 29, 2014 02:43 PM|damienBod|LINK
Add GeoJson from NuGet to your project.
Create a new json formatter in you project and replace your existing json serializer in the web api.
If your require that your web api returns json as well, then you must not replace the json media formatter but instead create a new custom formatter and return this in the action method always or when the request header contains your test/geojson accept
This site provides good documentation on media formatters.
hope this helps greetings Damien
Feb 03, 2014 03:40 AM|Ben Grice|LINK
Thanks Damien, this looks like the way to go, we're working on this avenue. Just for info, we're following the example set out here