用于 ASP.NET MVC/C# 的 WFS(Web 功能服务)
基本版本: 是否有可在 ASP.NET MVC 应用程序中使用的轻量级 C#/.NET 库来服务 WFS 请求?
详细版本:我们正在开发一个 C# ASP.NET MVC 应用程序,该应用程序位于包含一些基本地理空间数据的 Sql Server 2008 数据库之上。我需要能够在浏览器的地图背景上显示带有简单点/线要素(数据库实体)的地图。计划是使用 OpenLayers 来渲染地图。背景地图由第三方使用 WMS 提供,因此我知道我可以连接并显示该信息。
我遇到的问题是,我们希望在地图上显示的数据需要由用户过滤(当前以表格形式显示)。看来我确实需要公开 WFS 服务以允许用户过滤数据以在地图上显示。
是否有一个轻量级(并且最好是免费的)C# 组件可以做到这一点?我对 SharpMap 进行了短暂的使用,它在很大程度上适合我们的需求,但是虽然我可以使用它来渲染地图和我们的数据我无法弄清楚如何将过滤器(这将改变请求的请求)应用于渲染的数据。或者有人有其他建议吗?
如果可能的话,我试图避免使用全面的地理服务器(例如 GeoServer、MapServer 等),因为我们的要求非常基本,而且我们有各种基础设施限制。
提前致谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
严格来说,这并不是我在标题中提出的问题的答案,但我找到了解决我的问题的方法,希望能够帮助其他人。
我没有尝试实现 WFS 服务,而是简单地实现了一个返回轻量级 GeoJSON 对象的控制器。这允许我的控制器使用我在系统其他地方使用的过滤/查询机制。 GeoJSON 与 OpenLayers 配合良好。
我必须实现一些简单的代码来将
SqlGeography
序列化为 GeoJSON。我尝试使用SqlGeography.AsGml()
但 OpenLayers 对 GML 的支持似乎不太先进。希望这对某人有帮助。
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 theSqlGeography.AsGml()
but OpenLayers support for GML does not seem too advanced.Hope this helps someone.
WFS 描述了一种 Web 服务。您可以使用 WCF 在 .net 中实现此功能。目前还没有为此给出示例代码。您可以在 ASP.Net 应用程序中使用 WCF。
来源
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