Geography and polygon

Giganews Newsgroups
Subject: Geography and polygon
Posted by:  alhopite…@gmail.com
Date: Mon, 27 Dec 2010

?Hi!

I am trying to understand what's wrong with the following code on 2008 R2:

INSERT INTO [TransObjectSource].[dbo].[Quadrant] (Area)
VALUES(geography::STGeomFromText('POLYGON((45.835 5.9711, 45.835 6.1669,
45.928 6.1669, 45.928 5.9711, 45.835 5.9711))',4326) )

I get this error message:

Msg 6522, Level 16, State 1, Line 1
A .NET Framework error occurred during execution of user-defined routine or
aggregate "geography":
System.ArgumentException: 24200: The specified input does not represent a
valid geography instance.
System.ArgumentException:
  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 have to point out I got this polygon definition from a table  created and
populated in a DENALI CTP1 database.

Thanks for your help, now heading to bed after taking an aspirin.

Cheers!

Replies