【问题标题】:Why I get exception when I try to create polygon using DbGeometry?为什么我尝试使用 DbGeometry 创建多边形时出现异常?
【发布时间】:2018-02-21 22:43:31
【问题描述】:

这里我尝试使用 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);

标签: c# .net gis geospatial geocoding


【解决方案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))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多