Locked Sending spatial data to C# application:

  • giovedì 12 gennaio 2012 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

Tutte le risposte

  • giovedì 12 gennaio 2012 12:03
     
     Risposta suggerita Contiene codice

    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/
    • Proposto come risposta Horizon_Net giovedì 12 gennaio 2012 13:58
    •