0

嗨,我正在尝试创建一个地理区域,我们的西北纬度和经度,东南纬度和经度但是当我使用这些坐标运行查询时出现此异常。

选择 (geography::STGeomFromText('POLYGON((-0.534717 0.524190,0.426951 0.524190,0.426951 -0.578706,-0.534717 -0.578706,-0.534717 0.524190))', 4326))

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. To create a larger than hemisphere geography instance, upgrade the version of SQL Server and change the database compatibility level to at least 110.
Microsoft.SqlServer.Types.GLArgumentException: 
   at Microsoft.SqlServer.Types.GLNativeMethods.GeodeticIsValid(GeoData& g, Double eccentricity, Boolean forceKatmai)
   at Microsoft.SqlServer.Types.SqlGeography.IsValidExpensive(Boolean forceKatmai)
   at Microsoft.SqlServer.Types.SqlGeography..ctor(GeoData g, Int32 srid)
   at Microsoft.SqlServer.Types.SqlGeography.GeographyFromText(OpenGisType type, SqlChars taggedText, Int32 srid)
.
4

1 回答 1

1

您的环方向不正确,因此您的多边形是“由内向外”。你应该改用这个:

SELECT geography::STGeomFromText('POLYGON ((0.426951 0.52419, -0.534717 0.52419, -0.534717 -0.578706, 0.426951 -0.578706, 0.426951 0.52419))', 4326);
于 2012-08-15T14:20:13.410 回答