I have trouble with some shapes and inserting into a SQL server table with a geography field defined.
It tells me "The specified input does not represent a valid geography instance". I know I can get around this by also having a geometry field defined and use that and SQL server to clean up the object before updating the geography field .
Is there any way to clean up the ring orientation, intersecting lines of a polygon, ect.. without pushing the feature to SQL Server and performing the cleaning there? I tried to see if there was a MakeValid method on the shape or the feature and there doesn't seem to be. I would rather take care of cleaning the shape client side than server side if I can.
Example of code where newFeature has invalid geometry.
In case anyone is interested, this is how I solved my issue. I have it in my c# code now but I will be moving it to a stored procedure where I can pass in WKT and get back WKT that is clean and ready to be used in a geography field. I also included a sample of how I check to see if my shape is valid for a geography or not. (SQL 2008)