当我尝试使用DbGeometry创建多边形时,为什么会出现异常?

时间:2018-02-21 22:43:31

标签: 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);

当上面的行执行时,我收到此异常消息:

Exception has been thrown by the target of an invocation.

的InnerException:

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

知道为什么我上面会有例外吗?

1 个答案:

答案 0 :(得分: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);

请参阅维基百科:https://en.wikipedia.org/wiki/Well-known_text

POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))