具有以下空间约束:
ALTER TABLE [dbo].[TRANS_TRAILS_LN] WITH CHECK ADD CONSTRAINT [g10_ck] CHECK (([SHAPE].[STSrid]=(4269)))
GO
ALTER TABLE [dbo].[TRANS_TRAILS_LN] CHECK CONSTRAINT [g10_ck]
GO
和索引:
CREATE SPATIAL INDEX [S10_idx] ON [dbo].[TRANS_TRAILS_LN]
(
[SHAPE]
)USING GEOGRAPHY_GRID
WITH (
GRIDS =(LEVEL_1 = MEDIUM,LEVEL_2 = MEDIUM,LEVEL_3 = MEDIUM,LEVEL_4 = MEDIUM),
CELLS_PER_OBJECT = 16, PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
在带有地理列的表
上[SHAPE] [geography] NOT NULL,
我可以在整个美国东部添加功能。当我到达-90度以及更深的西部时,我收到以下错误:
A .NET Framework error occurred during execution of user-defined routine or aggregate "geography":
System.FormatException: 24201: Latitude values must be between -90 and 90 degrees.
System.FormatException:
at Microsoft.SqlServer.Types.GeographyValidator.ValidatePoint(Double x, Double y, Nullable`1 z, Nullable`1 m)
at Microsoft.SqlServer.Types.Validator.AddLine(Double x, Double y, Nullable`1 z, Nullable`1 m)
at Microsoft.SqlServer.Types.F]
我得到整个单半球限制,但这不是问题:我在一个半球。它是SRID(GCS NAD83)吗?可以不将此SRID与SQL Geography数据类型一起使用吗?
SQL 2008 R2
更新:以下显示lat值在-90和90之间。
SELECT a.OBJECTID, b.n,
a.SHAPE.STPointN(b.n).Lat AS Lattitude,
a.SHAPE.STPointN(b.n).Long AS Longitude
FROM dbo.TRANS_TRAILS_LN_2 AS a, num_seq AS b
WHERE b.n <= a.SHAPE.STNumPoints()
ORDER BY a.SHAPE.STPointN(b.n).Lat, b.n;
底部范围:
OBJECTID n Lattitude Longitude
9033 983 33.466981284 -119.038116174
9033 1000 33.4669817430001 -119.037982757
9033 982 33.4669820330001 -119.038128214
9033 984 33.4669823350001 -119.038103865
顶级范围:
OBJECTID n Lattitude Longitude
19 180 63.751484675 -149.291076228
19 177 63.7515265970001 -149.291518977
19 178 63.7515650700001 -149.291457788
19 179 63.751576146 -149.291381612