C# 为什么在尝试使用DbGeometry创建多边形时出现异常?

C# 为什么在尝试使用DbGeometry创建多边形时出现异常?,c#,.net,gis,geospatial,geocoding,C#,.net,Gis,Geospatial,Geocoding,以下是我如何尝试使用DbGeometry创建多边形: var t = System.Data.Spatial.DbGeometry.PolygonFromText("POLYGON(184124.95503725 666736.70253002, 184116.48837516 665712.23641656, 184946.22126044 666304.90276319, 184124.95503725 666736.70253002)", 2039); 执行上述行时,我收到以下异常消息

以下是我如何尝试使用DbGeometry创建多边形:

 var t = System.Data.Spatial.DbGeometry.PolygonFromText("POLYGON(184124.95503725 666736.70253002, 184116.48837516 665712.23641656, 184946.22126044 666304.90276319, 184124.95503725 666736.70253002)", 2039);
执行上述行时,我收到以下异常消息:

Exception has been thrown by the target of an invocation.
内部异常:

24142: Expected "(" at position 8. The input has "1".

你知道我为什么会出现上述异常吗?

我想你没有添加括号:

var t = System.Data.Spatial.DbGeometry.PolygonFromText("POLYGON((184124.95503725 666736.70253002, 184116.48837516 665712.23641656, 184946.22126044 666304.90276319, 184124.95503725 666736.70253002))", 2039);
参见维基百科:


行吗<代码>var t=System.Data.Spatial.DbGeometry.PolygonFromText(“多边形((184124.95503725 666736.70253002184116.48837516 665712.23641656184946.22126044 666304.90276319,184124.95503725 666736.70253002)),2039
POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))