将空间数据发送到C#应用程序: [英] Sending spatial data to C# application:

查看:104
本文介绍了将空间数据发送到C#应用程序:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以将空间数据发送到我的应用程序(在C#.NET中)吗?如果是这样,我怎么能实现呢?例如,我在SQL中有以下代码:SET @geom = geometry :: STGeomFromText('POLYGON((3 -6,8 -3,8 2 2,5 5,-2 0,3 -6))',4326如果我将
@geom发送到C#应用程序会发生什么?谢谢,Santosh

Hi, Can I send spatial data to my application (which is in C#.NET)? If so, how can I achieve that? For example I've the following code in SQL: SET @geom = geometry::STGeomFromText('POLYGON((3 -6, 8 -3, 8 2, 2 5, -2 0, 3 -6))', 4326) What happens if I send @geom to C# application? Thanks, Santosh

推荐答案

SQL Server中的空间功能由两个DLL库提供 - Microsoft.SqlServer.Types.dll(托管)和SqlServerSpatial.dll(非托管)。将Microsoft.SqlServer.Types.dll导入到C#项目中,您可以使用SqlGeography / SqlGeometry
类型,其方式与SQL Server中的地理/几何类型完全相同。所以你上面的例子就会变成ie

Spatial functionality in SQL Server is provided by two DLL libraries - Microsoft.SqlServer.Types.dll (managed) and SqlServerSpatial.dll (unmanaged). Import Microsoft.SqlServer.Types.dll into your C# project and you can use the SqlGeography/SqlGeometry type in exactly the same way as the geography/geometry type within SQL Server. So your example above would become i.e.


SqlGeometry geom = SqlGeometry.STGeomFromText(new SqlChars("POLYGON((3 -6, 8 -3, 8 2, 2 5, -2 0, 3 -6))"), 4326);


这篇关于将空间数据发送到C#应用程序:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆