With the following spatial constraint:
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
and index:
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
on a table with a Geography Column
[SHAPE] [geography] NOT NULL,
I am able to add features throughout the eastern US. Soon as I hit -90 deg and further west, I get the following error:
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]
I get the whole single hemisphere limitation, but this isn't the problem: I'm in a single hemisphere. Is it the SRID (GCS NAD83)? Can one not use this SRID with the SQL Geography data type?
SQL 2008 R2
Update: The following show that lat values fall well within -90 and 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;
Bottom range:
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
Top Range:
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