Free Support Forum - aspose.com

Truncated Decimals in WKT Strings

When converting IGeometry to WKT with the AsText() method, decimal precision is lost as compared to other libraries (SqlGeometry, DotSpatial).

For example:
-108.45392758962691 becomes:
-108.453927589627

This is because internally your code is generating number strings for WKT via:
stringBuilder.Append(num.ToString(CultureInfo.InvariantCulture));

What it should be is:
stringBuilder.Append(num.ToString("G17", CultureInfo.InvariantCulture));

Actually, num.ToString("R", CultureInfo.InvariantCulture) seems to test better for compatibility with how other libraries handle rounding. I would like to request that.

Hello, @DavidB!

Thank you for your interest in the Aspose.GIS product.

We have included this improvement request in our issue tracking system as GISNET-513. And we will update you here as soon as additional information is available.