locked
Error while appending geometry data RRS feed

  • Question

  • Redirect me if I'm posting this in the wrong forum:

    I'm trying to insert the following into a gemoetry field in the SQL table:

    "LINESTRING (-96.630453 27.99015423000001,-96.63046765 27.99021443999999,-96.6304725 27.9902343,-96.63049918 27.99034399,-96.63051227000001 27.99039778000001,-96.63051652 27.99041527000002,-96.63114336999999 27.99299115,-96.63147479999999 27.99457931000003,-96.63244181999998 27.99745483999999,-96.63323662000001 27.99994698000003,-96.63401051000001 28.00247986000002,-96.63512946999998 28.00614003000002,-96.63631110999999 28.01046058000003,-96.63702210999999 28.01267509,-96.63749309999999 28.01437353,-96.63801219000001 28.01618408000001,-28.23096999000001,-96.72966533000002 28.23182639000001,-96.73000201000001 28.23223809000002,-96.73000981 28.23224774000002,-96.73005087999998 28.23229857000003,-96.73000981 28.23224774000002,-96.73005087999998 28.23229857000003)"

    It throws the following message: Is there any functions available to check the validity, or correct the validity of the linestring?

    A .NET Framework error occurred during execution of user-defined routine or
    aggregate \"geometry\": \r\nSystem.ArgumentException: 24144:
    This operation cannot be completed because the instance is not valid.
    Use MakeValid to convert the instance to a valid instance.
    Note that MakeValid may cause the points of a geometry instance to shift
    slightly.\r\nSystem.ArgumentException:
     \r\n   at Microsoft.SqlServer.Types.SqlGeometry.ThrowIfInvalid()\r\n 
     at Microsoft.SqlServer.Types.SqlGeometry.STEquals(SqlGeometry other)\r\n." 
    string



    test
    • Moved by Ricky_Brundritt Friday, February 26, 2010 9:57 PM wrong forum (From:Bing Maps: Map Control and Web services Development)
    Friday, February 26, 2010 9:12 PM

Answers

  • There is a way to make a geometry valid if it is invalid (i.e. end points don't match for geography). However your issue is that you are missing a longitude coordinate in one of your latlong pairs: "-96.63801219000001 28.01618408000001,-28.23096999000001,-96.72966533000002 28.23182639000001". Look for ",-28.23096999000001," in your linestring and add in the missing coordinate. I don't think the tools for making a geometry valid would work with this as you won't be able to turn this into a spatial object to begin with.

    Windows Live Developer MVP - http://rbrundritt.spaces.live.com
    Friday, February 26, 2010 9:56 PM