We are running into an issue where some of the WKT values we’ve previously generated using MapSuite and stored in the database are exploding when we try to create a BaseShape from them. We get the following error:
The format of the well known text is incorrect.
Parameter name: wellKnownText
An example of WKT that gets this is:
LINESTRING(68.9062449459175 33.9999938472282,68.9062446106414 34.0000059171687,68.9062446106414 34.0000059171687)
We’ve upgraded to the SQLTypes (maybe that has something to do with it) but haven’t seen this issue before today.
We are using WPF version 6.0.74.0
Any insight would be appreciated. Thank you.
.Ryan.
Invalid WKT
I’ve reverted back to 6.0.4.0 and everything loads fine coming out of the same database.
Ryan,
The SQLTypes are much more strict with the WKT and WKB they allow however I’m sure there is something we can do to fix this. What we need to do is add some exception checking so that if it is invalid that we call the new MakeValid on it and in 99% of the cases it repairs it and makes it valid. These things have been slowly surfacing so we need to take care of that. Thanks for pointing that out and we plan to get a fix in early next week.
David
Thanks David, could you let me know when this is up for testing so I can verify it for you?
.Ryan.
Hi Ryan,
Sorry for the long time delay, but we are still working on it, we cannot guarantee we'll cover all the scenarios because of the performance, so we are looking for a best solution to balance the performance and the validation. Can you use the following code as a workaround first?
BaseShape.GeometryLibrary = GeometryLibrary.Managed;
Feature feature = new Feature("LINESTRING(68.9062449459175 33.9999938472282,68.9062446106414 34.0000059171687,68.9062446106414 34.0000059171687)");
BaseShape.GeometryLibrary = GeometryLibrary.Unmanaged;
feature = feature.MakeValid();
Or you can use the BaseShape.GeometryLibrary = GeometryLibrary.Managed. all the time to use the old NTS topology rules.Once we have a result, we'll let you know.
Thanks,
Edgar