locked
Why is this invalid geometry? Very simple 3 point polygon. RRS feed

  • Question

  •  

    How come I am receiving an error when entering the following query?

    select geography:Tongue TiedTPolyFromText('POLYGON((33.837 -117.155, 33.816 -117.155, 33.815 -117.175, 33.837 -117.155))', 4326)

     

    This is a very small polygon in Perris, California.

     

    The error I get is:

    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(GeometryData g)
       at Microsoft.SqlServer.Types.SqlGeography.IsValidExpensive()
       at Microsoft.SqlServer.Types.SqlGeography.ConstructGeographyFromUserInput(GeometryData g, Int32 srid)
       at Microsoft.SqlServer.Types.SqlGeography.STPolyFromText(SqlChars polygonTaggedText, Int32 srid)

    Friday, February 8, 2008 10:50 PM

Answers

  • I think I figured it out.  It turns out my polygons have points stated in clockwise order.  When I change them to counter-clockwise it works fine.

     

    Unfortunately all my polygons in this particular shape file are all clockwise and avg 25 points each.  Ugh!

    Friday, February 8, 2008 11:55 PM

All replies

  • I think I figured it out.  It turns out my polygons have points stated in clockwise order.  When I change them to counter-clockwise it works fine.

     

    Unfortunately all my polygons in this particular shape file are all clockwise and avg 25 points each.  Ugh!

    Friday, February 8, 2008 11:55 PM
  • very good !
    Monday, June 27, 2011 1:29 AM