none
Latitude values must be between -90 and 90 degrees

    Question

  • Hi,

    I am trying to run this statement


    INSERT INTO Venue VALUES('RigOne', geography::STGeomFromText('POINT(27.984700 -95.899658)',4326));

    but i get the following error, anyone has any idea. I am new with SQL Server Spatial data.

    Msg 6522, Level 16, State 1, Line 3
    A .NET Framework error occurred during execution of user-defined routine or aggregate "geography":
    System.FormatException: 24201: Latitude values must be between -90 and 90 degrees.
    System.FormatException:
       at Microsoft.SqlServer.Types.GeographyValidator.ValidatePoint(Double x, Double y, Nullable`1 z, Nullable`1 m)
       at Microsoft.SqlServer.Types.Validator.BeginFigure(Double x, Double y, Nullable`1 z, Nullable`1 m)
       at Microsoft.SqlServer.Types.ForwardingGeoDataSink.BeginFigure(Double x, Double y, Nullable`1 z, Nullable`1 m)
       at Microsoft.SqlServer.Types.CoordinateReversingGeoDataSink.BeginFigure(Double x, Double y, Nullable`1 z, Nullable`1 m)
       at Microsoft.SqlServer.Types.OpenGisWktReader.ParsePointText(Boolean parseParentheses)
       at Microsoft.SqlServer.Types.OpenGisWktReader.ParseTaggedText(OpenGisType type)
       at Microsoft.SqlServer.Types.OpenGisWktReader.Read(OpenGisType type, Int32 srid)
       at Microsoft.SqlServer.Types.SqlGeography.GeographyFromText(OpenGisType type, SqlChars taggedText, Int32 srid)

    I appreciate the help in advance

    Tuesday, April 19, 2011 4:30 PM

Answers

  • No, to change the parameter order:

    INSERT INTO Venue VALUES('RigOne', geography::STGeomFromText('POINT(-95.899658 27.984700)',4326));


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing
    • Marked as answer by Farrukh Lala Tuesday, April 19, 2011 7:45 PM
    Tuesday, April 19, 2011 6:47 PM

All replies

  • I think your coordinate values are out of range, because Vanue's coordinate system is WGS 84 (EPSG:4326). 
    X must be between 180, -180, Y must be between 90, -90.
    Y value sould be -95.899658 % 90 = -5.899658, or is not valid.

    Make everything as simple as possible, but not simpler.
    Tuesday, April 19, 2011 4:54 PM
  • Hello,

    Have you used the correct coordination; POINT expect as parameter for POINT(Latitude, Longitude)?


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing
    Tuesday, April 19, 2011 5:06 PM
  • It looks like you've used incorrect coordinate ordering. The syntax for a Point in Well-Known Text format, which is what the STGeomFromText method uses, is:

    POINT(Longitude Latitude)

    In your case, you're therefore trying to create a point at a longitude of 27.984700, latitude of -95.899658. Valid latitude values only range between -90 (at the south pole) to +90 (at the north pole).

    Did you mean to create a point at latitude of 27.984700, longitude of -95.899658, which is a point in the gulf of Mexico, about 100 miles south of Houston?


    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Tuesday, April 19, 2011 5:55 PM
  • The way i got the Lat and Long is by right clicking on google map.

    If i understood correctly you want me to change to -5 if it is -95. Correct?

    Thanks

     

     

    Tuesday, April 19, 2011 6:38 PM
  • No, to change the parameter order:

    INSERT INTO Venue VALUES('RigOne', geography::STGeomFromText('POINT(-95.899658 27.984700)',4326));


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing
    • Marked as answer by Farrukh Lala Tuesday, April 19, 2011 7:45 PM
    Tuesday, April 19, 2011 6:47 PM
  • Tanoshimi,

    First of all thanks for the reply. Yes i am trying to create a point for in gulf of mexico to show the location of oil rig.

    Tuesday, April 19, 2011 7:36 PM