New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading polygons from MS SQL cause "shell is empty but holes are not" #407
Comments
Same problem here. Geography: WKT: geography.IsValidDetailed() : System Configuration.NET Core 3.1 |
Never mind my previous message, I figured my problem out. It was caused by clockwise ring orientation.
C#:
|
Thanks @kludcev. I ran the SQL query to fix the shapes. |
For me the SQL @kludcev provided didn't fix the issues in my case as I had a mixture of good and bad orientations and there was no way to tell which was which (the bad records returned angle < 90). Had thousands of records, the error kept appearing. I had geography columns as well. I finally came up with the SQL that worked for me and fixed the issue, hope it helps someone. Please test first as this was done on a very simple polygon.
The extra MakeValid() at the end may be over kill but hey ho |
I've been struggling with this issue ('shell is empty but holes are not') and if only (...if...only...) there was a way to map a SQL Server geography column to an EF type that could then map back to SQL Server. By mapping a Geography column to an NTS Geometry type, I am then unable to use C# to fix the geography and update. At least I don't know of a way. Is there one? |
You need to use a |
I am trying to write an empty polygon to an SQL Server geography column, and none of the above worked for me. Both Can anyone tell me how I can construct an empty polygon and then write it to SQL Server? |
Description
I have some simple polygons stored in a MS SQL (geography column) that the database says are valid.
However, NetTopology cannot load them. The exception ("shell is empty but holes are not") is thrown.
Geography value
0xE6100000022405000000DB909E2D6D6F474001000020175A444014E5081BA266474001000020175A444014E5081BA26647400100002037494440DB909E2D6D6F47400100002037494440DB909E2D6D6F474001000020175A444001000000010000000001000000FFFFFFFF0000000003
WKT
POLYGON ((40.703830718994148 46.870519354271629, 40.703830718994148 46.801822070449049, 40.571994781494148 46.801822070449049, 40.571994781494148 46.870519354271629, 40.703830718994148 46.870519354271629))
System Configuration
NetTopology Suite 3.1.3
EF Core 3.1.3
.NET Core 3.1
The text was updated successfully, but these errors were encountered: