Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

polygon-geography Expand / Collapse
Posted Thursday, May 16, 2013 5:41 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, May 15, 2014 2:05 PM
Points: 73, Visits: 475
Hi all,

i'm facing some issue in geography datatype when converting into polygon
This working fine

SET @polygon=GEOGRAPHY::STPolyFromText('POLYGON ((-0.10200500506471144 51.517787451292115, -0.05943298358033644 51.49834206046075, -0.04981994647096144 51.52868178886899, -0.10200500506471144 51.517787451292115))', 4326)

BUT... if the points are changed(2 and 3) its giving error

SET @polygon=GEOGRAPHY::STPolyFromText('POLYGON ((-0.10200500506471144 51.517787451292115, -0.04981994647096144 51.52868178886899, -0.05943298358033644 51.49834206046075, -0.10200500506471144 51.517787451292115))', 4326)

this is giving error Msg 6522, Level 16, State 1, Line 3
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.
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)
Post #1453447
Posted Thursday, May 16, 2013 11:31 AM



Group: General Forum Members
Last Login: Friday, February 12, 2016 12:13 AM
Points: 120, Visits: 3,037
You change the ring order and with that You select everything around your polygon (rest of the world).
This is limitation of geography datatype in the version You are using.
Post #1453703
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse