locked
single hemisphere issue RRS feed

  • Question

  • Hello all,
    I already seen some topics around, however I can't solve my problem.
    I want to keep this polygon in a SQL. I use SQL Server 2008 Developer SP1 and I had also installed Denali CTP1. I also tried to split the polygon into mutlipolygon, but I get the same error. Please help me
    polygon = GEOGRAPHY::STGeomFromText('POLYGON((19.6381 -12.56111, 180 -12.56111, 180 82.50045, 19.6381 82.50045, 19.6381 -12.56111))', 4326)
    The error:
    Msg 6522, Level 16, State 1, Line 1
    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.
    Microsoft.SqlServer.Types.GLArgumentException: 
       at Microsoft.SqlServer.Types.GLNativeMethods.ThrowExceptionForHr(GL_HResult errorCode)
       at Microsoft.SqlServer.Types.GLNativeMethods.GeodeticIsValid(GeoData g)
       at Microsoft.SqlServer.Types.SqlGeography.IsValidExpensive()
       at Microsoft.SqlServer.Types.SqlGeography.ConstructGeographyFromUserInput(GeoData g, Int32 srid)
       at Microsoft.SqlServer.Types.SqlGeography.GeographyFromText(OpenGisType type, SqlChars taggedText, Int32 srid)
    Thanks a lot.
    Joao Vicente

    Thursday, July 7, 2011 10:49 PM

Answers

  • The problem is Solved. I re-installed the Denali CTP1 and stop SQL Server 2008 and SQLExpress services and connect to the correct Database and done!

     

    Btw, thanks for the compatibility level 110!


     Have a nice weekend

    • Marked as answer by KJian_ Monday, July 18, 2011 5:54 AM
    Friday, July 8, 2011 4:11 PM

All replies

  • Your polygon specification works just fine for me in Denali CTP1. Here's the code.


    declare @polygon geography
    set @polygon = GEOGRAPHY::STGeomFromText('POLYGON((19.6381 -12.56111, 180 -12.56111, 180 82.50045, 19.6381 82.50045, 19.6381 -12.56111))', 4326)
    select @polygon.STDimension() -- returns 2, its a polygon
    select @polygon.STArea() -- returns 186264202782204

    Cheers, Bob Beauchemin, SQLskills

     

    Friday, July 8, 2011 12:34 AM
  • Weird.. don't work for me.


    Whats your SQL Server version? And Denali CTP1 ?

     


    Thanks 

    Friday, July 8, 2011 1:05 AM
  • Hi Joao,

    It did run on Denali CTP1 (where they do allow spatial objects bigger than a hemisphere). It didn't run on previous versions of SQL Server (where this isn't allowed). I just cut/pasted it the few lines I posted, from the Denali CTP1 SSMS after running it.

     

    Cheers, Bob

    Friday, July 8, 2011 2:37 AM
  • Works fine for me on Denali CTP1 also.

    @Joao - Since "bigger than a hemisphere" geometries were only introduced in Denali, you need to make sure that the Compatibility Level of your database is set to "SQL Server "Denali" (110). You can check this by looking in the options tab of the database properties in SSMS, or by running:

    EXEC sp_helpdb;

    It needs to say 110 in the compatibility_level of the database against which you're running this query.
    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Friday, July 8, 2011 9:05 AM
    Answerer
  • Thanks for the tip!

    However, I can't change the compatibily_level to 110.

     

     

    Msg 15048, Level 16, State 1, Line 1

    Valid values of the database compatibility level are 80, 90, or 100.

    I will try to re-install Denali CTP1.

    Thanks again

     

    [EDIT] Still not possible to use compatibily level at 110.
    Any tip about that?
    Thanks

     

    Friday, July 8, 2011 11:36 AM
  • Have you got side-by-side installations of SQL Server 2008 and Denali CTP1 on the same machine? Are you definitely sure it's the Denali instance that you're connecting to?

    What do you get when you run the following?:

    SELECT @@version

    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Friday, July 8, 2011 2:28 PM
    Answerer
  • The problem is Solved. I re-installed the Denali CTP1 and stop SQL Server 2008 and SQLExpress services and connect to the correct Database and done!

     

    Btw, thanks for the compatibility level 110!


     Have a nice weekend

    • Marked as answer by KJian_ Monday, July 18, 2011 5:54 AM
    Friday, July 8, 2011 4:11 PM