'The specified input does not represent a valid geography instance' exception when using SqlGeographyBuilder

后端 未结 2 586
抹茶落季
抹茶落季 2021-01-06 19:17

I\'ve written a small application that reads in from a series of KML files and then converts them into the Microsoft.SqlServer.Types.SqlGeography type using the

2条回答
  •  情书的邮戳
    2021-01-06 19:45

    I've had the same problem and solved it using a project called Sql Server Spatial Tools (http://sqlspatialtools.codeplex.com).

    It has (among other interesting stuff) these two methods:

    • MakeValidGeographyFromGeography
    • MakeValidGeographyFromText (which receives a WKT string)

    They modify the points so that it conforms to the geography restrictions.

    It works really, really well, and I've used it for several months now without any problem.

提交回复
热议问题