Difference between Geometries created by NetTopologySuite 6 and 8

36 Views Asked by At

I have an EF Core DbContext, that used to use EF Core 6 with NetTopologySuite. I use it to edit a database that's used by a different C# .NET application, that I do not control. When I inserted Geometries with that version, they were compatible with that application.

Now I have updated EF Core to version 8 (and with it, NetTopologySuite), but now the Geometries that my code creates are somehow different, but I could find no documentation of a change in NetTopologySuite.

This is what the difference looks like in SSMS:

"Old"-Geometry binary: 0x00000000010D00000000806DD4C000000000605D14410000000000308140
"Old"-Geometry WKT: POINT (-20918 333656)

"New"-Geometry binary: 0x00000000010F00000000806DD4C000000000605D14410000000000308140000000000000F8FF
"New"-Geometry WKT: POINT (-20918 333656)

The 2 geometries represent the same WKT, but somehow have completely different binary.

My goal is to create the "old style" binary with my code, but I have no idea what to change.

1

There are 1 best solutions below

0
Pipelynx On BEST ANSWER

I have found the difference now: The "new" binary has an M-Value at the end.

The solution is to give my NetTopologySuite.NtsGeometryServices.Instance a DotSpatialAffineCoordinateSequenceFactory with Ordinates.XYZ as a parameter.

Then no M-Values are written into the binary representations, and the other program is happy.