Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WFS (Web Feature Service) for ASP.NET MVC/C#

Basic version: Is there a lightweight C#/.NET library that can be used in an ASP.NET MVC app to service WFS requests?

Detailed version: We are developing a C# ASP.NET MVC app that sits on top of a Sql Server 2008 database with some basic geospatial data. I need to be able to display a map with our simple point/line features (DB entities) over a map background in the browser. The plan is to use OpenLayers to render the map. The background map is being provided by a third-party using WMS so I know I can connect to and display that OK.

The problem I have is that the data we wish to show over the map need to be filtered by the user (it's currently shown in tabular form). It appears that I really need to expose a WFS service to allow the user to filter data for display on the map.

Is there a lightweight (and ideally free) C# component that can do this? I have had a brief play with SharpMap which is largely suitable for our needs, but while I can use it to render a map and our data I've not been able to figure out how to apply filters (which will vary request to request) to the rendered data. Alternatively does anyone have any other suggestions?

I'm trying to avoid use of full-scale geo-servers (e.g. GeoServer, MapServer, etc.) if possible as our requirements are quite basic and we have various infrastructure constraints.

Thanks in advance!

like image 374
Tim Croydon Avatar asked Mar 09 '11 14:03

Tim Croydon


2 Answers

Not strictly an answer to the question as I posed it in the title but I have found a solution to my problem that will hopefully help others.

Rather than trying to implement a WFS service I have simply implemented a controller that returns lightweight GeoJSON objects. This allows my controller to use the filtering/query mechanisms I use elsewhere in my system. GeoJSON works well with OpenLayers.

I had to implement some simple code to serialise SqlGeography into GeoJSON. I tried using the SqlGeography.AsGml() but OpenLayers support for GML does not seem too advanced.

Hope this helps someone.

like image 102
Tim Croydon Avatar answered Oct 03 '22 08:10

Tim Croydon


WFS describes a webservice. You can implement this in .net using WCF. At the moment no sample code is given for this. You can use WCF in an ASP.Net application.

source

like image 24
oɔɯǝɹ Avatar answered Oct 03 '22 08:10

oɔɯǝɹ