This project is read-only.


Jul 31, 2007 at 7:16 PM
How does the NTS DLL that comes with the latest source code compare to the Google Code project? When I compile the NTS libs from the original source code, the assembly version is, whereas the DLL included in MsSqlSpatial has an assembly version of
Aug 1, 2007 at 2:40 AM
Edited Aug 1, 2007 at 2:41 AM
The NTS code revision used is documented in commits. The same for other dependencies. The last one for NTS is changset 23807 description: "NTS code base updated to revision 174 [of Google Code repository]"

Ideally, the next MsSqlSpatial release should be bundled with an "official" release of every dependency, in order to properly track issues and forward them to respective projects if needed.

Best regards,
Ricardo Stuven.
Aug 3, 2007 at 2:14 PM
For future reference,

The latest changeset for NTS source code is actually 24160-- the code I was looking for was not part of NTS in the changeset you cited. The problem I wanted to debug started at the ShapefileDataReader class.

I had a shapefile that I was having trouble reading-- the error was an EOF exception, because the DBF reader expected n lines, and instead got n-m lines (m is sort of arbitrary, but less than n). What was stranger was that my personal computer was reading the file fine, while a colleague's computer wasn't.

After downloading the changeset, and then linking the Console project to the source code instead of the DLL, I found that the Shapefile reader was skipping some of the characters, and reading the next character in the file to fill the field in the table. Upon further inspection I saw that the DBF had accented characters, and those characters were the ones being skipped by the reader. The total number of these characters equalled m's lines worth of characters.

I found the error to be in the DbaseFileEnumerator. When I opened the DBF in MS Excel, I saw that the characters were showing up differently. Apparently this file was using a different encoding for the foreign characters (UTF-16 instead of ASCII). To fix this the DbaseFileEnumerator constructor had this line:

_dbfStream = new BinaryReader( stream );

changed to:

_dbfStream = new BinaryReader( stream, System.Text.Encoding.Default );

Maybe the NTS library needs a few overloaded ctors and methods to allow specification of the DBF's encoding?

Aug 3, 2007 at 6:30 PM
NTS is unable to manage DBF with chars with non ASCII chars... i'm not sure but i think this is a limitation of the DBF file format used by shapefile specifications.