locked
What is wrong with this polygon? RRS feed

  • Question

  • I am trying to store some simple rectangle polygons in a geography field, but I keep getting the following error:

    System.ArgumentException: 24200: The specified input does not represent a valid geography instance.

    Could someone please tell me what is wrong with this WKT? 

    SELECT geography::STGeomFromText('POLYGON((

    -119.76326468248 39.441673758198,

    -119.76219319366 39.441673758198,

    -119.76219319366 39.440559409825,

    -119.76326468248 39.440559409825,

    -119.76326468248 39.441673758198))', 4326)

    Monday, April 19, 2010 6:35 AM

Answers

  • Hello,

    You forgot the "Left-Hand Rule"; just turn the points around:

    SELECT geography::STGeomFromText(

    'POLYGON(( -119.76326468248 39.441673758198,

               -119.76326468248 39.440559409825,

               -119.76219319366 39.440559409825,

               -119.76219319366 39.441673758198,

               -119.76326468248 39.441673758198))', 4326).ToString()

     

     


    Olaf Helper ----------- * cogito ergo sum * errare humanum est * quote erat demonstrandum * Wenn ich denke, ist das ein Fehler und das beweise ich täglich http://olafhelper.over-blog.de
    • Proposed as answer by Tom Li - MSFT Tuesday, April 20, 2010 8:39 AM
    • Marked as answer by Tom Li - MSFT Monday, April 26, 2010 11:25 AM
    Monday, April 19, 2010 7:16 AM