polygon-geography

  • Hi all,

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

    This working fine

    DECLARE @polygon GEOGRAPHY

    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

    DECLARE @polygon GEOGRAPHY

    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.

    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)

    .

  • 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.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply