获取" SpatialTypeName"来自DbGeography

时间:2017-07-31 12:35:54

标签: leaflet geospatial

我有一组坐标应该是多边形但有时候是多边形,我需要检查它是什么:

if (DbGeography.FromText(Microsoft.SqlServer.Types.SqlGeography.STGeomFromText(new System.Data.SqlTypes.SqlChars(json.Polygon.Value), srid).ToString(), srid)
                            .SpatialTypeName.Equals("Polygon"))

但我的问题是我收到了这个错误:

DbGeography.FromText(Microsoft.SqlServer.Types.SqlGeography.STGeomFromText(new System.Data.SqlTypes.SqlChars(json.Polygon.Value), srid).ToString(), srid).SpatialTypeName   'DbGeography.FromText(Microsoft.SqlServer.Types.SqlGeography.STGeomFromText(new System.Data.SqlTypes.SqlChars(json.Polygon.Value), srid).ToString(), srid).SpatialTypeName' threw an exception of type 'System.Reflection.TargetInvocationException'    string {System.Reflection.TargetInvocationException}

if

的一部分
DbGeography.FromText(Microsoft.SqlServer.Types.SqlGeography.STGeomFromText(new System.Data.SqlTypes.SqlChars(json.Polygon.Value), srid).ToString(), srid)

观看是:

{SRID=4326;POLYGON ((-0.5504724383354187 51.379008223398628, -0.55046439170837391 51.379009897541955, -0.55100619792938232 51.378588011485647, -0.5504375696182251 51.378588011485647, -0.55017471313476562 51.379023290686426, -0.55046439170837391 51.379009897541955, -0.5504724383354187 51.379008223398628))}

但它无法获得.SpatialTypeName而且我不知道我做错了什么

0 个答案:

没有答案