1
我試圖插入一個多邊形到一個地理類型字段在SQL Server 2012中這是SQL Server 2012「超單半球」錯誤,實際上是SRID錯誤嗎?
UPDATE tblProjects
SET tblProjects.Boundary = geography::STGeomFromText('POLYGON ((-93.30388806760311 27.994401411046173, -94.62224744260311 33.37641235124676, -79.70281384885311 31.80289258670676, -93.30388806760311 27.994401411046173))',4326)
WHERE tblProjects.ProjectID = 1;
我收到以下錯誤,儘管事實上我的多邊形是在一個半球:
Msg 6522, Level 16, State 1, Line 1
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)
我假設這是與空間參考ID作爲以下返回NULL
相關聯的錯誤:
SELECT distinct Boundary.STSrid AS SRID
FROM dbo.tblProjects;
我在這個假設中正確嗎?我如何去設置SRID?我試圖返回一個錯誤:
UPDATE dbo.tblProjects
SET Boundary.STSrid = 4326;
錯誤:
Msg 5302, Level 16, State 1, Line 1
Mutator 'STSrid' on 'Boundary' cannot be called on a null value.