2

I'm trying to UPDATE a Geography field in an SQL Server 2012 database using the output of a web mapper. I got the dreaded "The specified input does not represent a valid geography instance because it exceeds a single hemisphere," error when running the command. I found that by reversing the order of the vertices the UPDATE command works as expected.

I see that SQL Server 2012 includes a ReorientObject() method that does this task, but I don't know how to incorporate it into my SQL UPDATE command. The following returns the same "single hemisphere" error.

UPDATE tblProjects
SET tblProjects.Boundary = geography::STGeomFromText( 'POLYGON ((-93.30388806760311 27.994401411046173, -94.62224744260311 33.37641235124676, -79.70281384885311 31.80289258670676, -93.30388806760311 27.994401411046173))',4326).ReorientObject()
WHERE tblProjects.ProjectID = 1 ;
1
  • I'd love to learn how to incorporate ReorientObject() on a simple select. Nov 1, 2019 at 20:06

1 Answer 1

0

This should update your column:

UPDATE yourtable SET column = column.MakeValid().ReorientObject();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.