开发者

Inserting geography: The specified input does not represent a valid geography instance because it exceeds a single hemisphere

I'm trying to insert geography fields into SQL Server 2008 for specific areas of the Netherlands. Once I try to run any of my queries, I get this error:

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.

I've been looking around the internet and I've read explanations of this 开发者_JAVA技巧error. It should occur once the bounding box of all points is larger than half the earth. The problem here is, that I already get the error for a small island which is located at 53 degrees North. Here is the query I've been using:

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))

The island I've got the borders of van be viewed in Google Maps. The points also take some sea around it, but not very much.

Can anybody explain to me why the system thinks I'm using an area that is too large for a geography field?


"A common reason for this error is that a polygon has the wrong ring orientation" - sounds to me like you have to specify the points in a particular order - if you get it backwards, you're asking for everything outside of the points you're providing, which would indeed be more than a hemisphere.

If I reverse the order of the coordinates you've provided, it constructs the polygon fine:

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)

The example given on Technet is a ring around the equator - how would the system know whether you intended to encompass the Northern or Southern hemisphere, without some rule w.r.t. the order of the points in the polygon.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜