Locked Sending spatial data to C# application:

  • 2012년 1월 12일 목요일 오전 10:31
     
     
    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

모든 응답

  • 2012년 1월 12일 목요일 오후 12:03
     
     제안된 답변 코드 있음

    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);
    

     


    twitter: @alastaira blog: http://alastaira.wordpress.com/
    • 답변으로 제안됨 Horizon_Net 2012년 1월 12일 목요일 오후 1:58
    •