Spatial data operations

Marco Salvatori 191 Reputation points
2021-01-14T10:50:45.65+00:00

Hello,

I have to migrate some routines written in VBNET in WPF environment on AZURE (webapi net core).

In these routines spatial operations such as union, intersection, etc. take place.

here is an example:

Private Sub example(ByVal sender As System.Object, ByVal e As System.EventArgs)  
        Dim myGeom1 As SqlGeometry = SqlGeometry.STGeomFromText(New SqlString("POLYGON((0 10, 10 10, 10 0, 0 0, 0 10))"), 0)  
        Dim myGeom2 As SqlGeometry = SqlGeometry.STGeomFromText(New SqlString("POLYGON((0 0, 4 0, 4 4, 0 4, 0 0))"), 0)  
        'Dim myGeom2 As SqlGeometry = SqlGeometry.STGeomFromText(New SqlString("POLYGON((1 -1, 1 5, 3 5, 3 -1, 1 -1))"), 0)  
        Dim myGeom3 As SqlGeometry = SqlGeometry.STGeomFromText(New SqlString("POLYGON((5 0, 8 0, 8 1, 5 1, 5 0))"), 0)  
        MsgBox(myGeom1.STArea)  
        MsgBox(myGeom2.STArea)  
        MsgBox(myGeom3.STArea)  
  
        Dim union As SqlGeometry = myGeom2.STUnion(myGeom3)  
        MsgBox(union.STArea)  
        Dim intersect As SqlGeometry = myGeom1.STIntersection(union)  
        MsgBox(intersect.STArea)  
        Dim difference As SqlGeometry = myGeom1.STSymDifference(union)  
        MsgBox(difference.STArea)  
    End Sub  

I wanted to migrate to use Microsoft.Spatial but it does not contain methods to recover the area for example microsoft.spatial.spatialoperations

more similar methods can be found in the System.Data.Entity.Spatial system.data.spatial.dbspatialservices.getarea

I read that Microsoft.Spatials will be more supported but at the moment they don't solve the problems for me.

how do you recommend to proceed?

Thanks

Developer technologies .NET Entity Framework Core
Developer technologies ASP.NET ASP.NET Core
Developer technologies .NET .NET Runtime
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.