简体   繁体   English

ASP.NET MVC / C的WFS(Web功能服务)#

[英]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? 基本版:是否有一个轻量级的C#/ .NET库可以在ASP.NET MVC应用程序中用于服务WFS请求?

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. 详细版本:我们正在开发一个C#ASP.NET MVC应用程序,该应用程序位于具有一些基本地理空间数据的Sql Server 2008数据库之上。 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. 计划是使用OpenLayers渲染地图。 The background map is being provided by a third-party using WMS so I know I can connect to and display that OK. 背景地图由第三方使用WMS提供,所以我知道我可以连接并显示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. 看来我真的需要公开一个WFS服务,以允许用户过滤数据以便在地图上显示。

Is there a lightweight (and ideally free) C# component that can do this? 是否有一个轻量级(理想情况下是免费的)C#组件可以做到这一点? 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. 我已经与SharpMap进行了简短的比赛,这很适合我们的需求,但是虽然我可以使用它来渲染地图和我们的数据,但我无法弄清楚如何应用过滤器(这会改变请求的请求)到渲染的数据。 Alternatively does anyone have any other suggestions? 或者,有没有人有任何其他建议?

I'm trying to avoid use of full-scale geo-servers (eg GeoServer, MapServer, etc.) if possible as our requirements are quite basic and we have various infrastructure constraints. 我正在努力避免使用全面的地理服务器(例如GeoServer,MapServer等),因为我们的要求非常基础,并且我们有各种基础设施限制。

Thanks in advance! 提前致谢!

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. 我没有尝试实现WFS服务,而是简单地实现了一个返回轻量级GeoJSON对象的控制器。 This allows my controller to use the filtering/query mechanisms I use elsewhere in my system. 这允许我的控制器使用我在系统中其他地方使用的过滤/查询机制。 GeoJSON works well with OpenLayers. GeoJSON适用于OpenLayers。

I had to implement some simple code to serialise SqlGeography into GeoJSON. 我必须实现一些简单的代码来将SqlGeography序列化为GeoJSON。 I tried using the SqlGeography.AsGml() but OpenLayers support for GML does not seem too advanced. 我尝试使用SqlGeography.AsGml()但OpenLayers对GML的支持似乎并不太高级。

Hope this helps someone. 希望这有助于某人。

WFS describes a webservice. WFS描述了一个Web服务。 You can implement this in .net using WCF. 您可以使用WCF在.net中实现此功能。 At the moment no sample code is given for this. 目前没有给出示例代码。 You can use WCF in an ASP.Net application. 您可以在ASP.Net应用程序中使用WCF。

source 资源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM