插入地理位置:指定的输入不代表有效的地理位置实例,因为它超过了单个半球

时间:2011-07-11 07:27:48

标签: sql-server-2008 postgis

我正在尝试将地理字段插入到荷兰特定区域的SQL Server 2008中。一旦我尝试运行任何查询,我就会收到此错误:

Msg 6522, Level 16, State 1, Line 4
A .NET Framework error occurred during execution of user-defined routine or aggregate "geography": 
Microsoft.SqlServer.Types.GLArgumentException: 24205: The specified input does not represent a valid geography instance because it exceeds a single hemisphere. Each geography instance must fit inside a single hemisphere. A common reason for this error is that a polygon has the wrong ring orientation.
Microsoft.SqlServer.Types.GLArgumentException: 
   at Microsoft.SqlServer.Types.GLNativeMethods.ThrowExceptionForHr(GL_HResult errorCode)
   at Microsoft.SqlServer.Types.GLNativeMethods.GeodeticIsValid(GeoData g)
   at Microsoft.SqlServer.Types.SqlGeography.IsValidExpensive()
   at Microsoft.SqlServer.Types.SqlGeography.ConstructGeographyFromUserInput(GeoData g, Int32 srid)
   at Microsoft.SqlServer.Types.SqlGeography.GeographyFromText(OpenGisType type, SqlChars taggedText, Int32 srid)
.
The statement has been terminated.

我一直在寻找互联网,我已经阅读了这个错误的解释。一旦所有点的边界框大于地球的一半,就应该发生这种情况。这里的问题是,我已经得到了一个位于北纬53度的小岛的错误。这是我一直在使用的查询:

SELECT geography::STGeomFromText('MULTIPOLYGON(((6.35252 53.53971,6.35212 53.52174,6.36724 53.52387,6.38227 53.52150,6.38970 53.51694,6.39702 53.50790,6.39692 53.50340,6.39305 53.49894,6.38164 53.49455,6.36663 53.49692,6.35156 53.49704,6.35121 53.48132,6.35042 53.44626,6.31547 53.43892,6.27398 53.43018,6.21441 53.41760,6.19402 53.41328,6.07924 53.42927,6.07404 53.44053,6.06469 53.46080,6.06007 53.47081,6.06007 53.47081,6.05910 53.47291,6.05910 53.47291,6.05012 53.49233,6.06520 53.49337,6.11046 53.49648,6.11822 53.50991,6.12599 53.52334,6.18612 53.51397,6.21633 53.51676,6.32207 53.52647,6.35252 53.53971)))', 4326))

我可以在Google Maps查看我有van的边界的岛屿。这些点也需要一些海洋,但不是很多。

有人可以向我解释为什么系统认为我使用的区域对于地理区域来说太大了吗?

1 个答案:

答案 0 :(得分:2)

“这个错误的一个常见原因是多边形有一个错误的响铃方向” - 听起来像你必须按特定的顺序指定点 - 如果你向后调整它,你要求的是除了你提供的分数,实际上不仅仅是一个半球。

如果我颠倒你提供的坐标的顺序,它会构造多边形:

select geography::STGeomFromText('MULTIPOLYGON(((
6.35252 53.53971,
6.32207 53.52647,
6.21633 53.51676,
6.18612 53.51397,
6.12599 53.52334,
6.11822 53.50991,
6.11046 53.49648,
6.06520 53.49337,
6.05012 53.49233,
6.05910 53.47291,
6.05910 53.47291,
6.06007 53.47081,
6.06007 53.47081,
6.06469 53.46080,
6.07404 53.44053,
6.07924 53.42927,
6.19402 53.41328,
6.21441 53.41760,
6.27398 53.43018,
6.31547 53.43892,
6.35042 53.44626,
6.35121 53.48132,
6.35156 53.49704,
6.36663 53.49692,
6.38164 53.49455,
6.39305 53.49894,
6.39692 53.50340,
6.39702 53.50790,
6.38970 53.51694,
6.38227 53.52150,
6.36724 53.52387,
6.35212 53.52174,
6.35252 53.53971
)))', 4326)

Technet上给出的例子是赤道周围的一个环 - 系统如何知道你是否打算包含北半球或南半球,没有一些规则w.r.t.多边形中点的顺序。