Daniel,

Thanks for the quick response.  Your reply helped a lot.

The app is designed to edit a road database and calculate times and
distances using custom speed limits.  I use MapInfo's MapX for
displaying the map and making changes to the roads.  MapX does all
updates to the TAB+ files.

I use mitab to quickly read through the road database file and build
and in-memory network representation of the roads for use in calculations.

> How do you know it's corrupt? And how do you know it's the .DAT and not 
> the .MAP or another file that's corrupt? 

I know the file is corrupt because if I tell mitab to go to the
records past the corruption it can.  Also MapX cannot retrieve
information about the roads that are corrupt, but can retrieve
information about all the other roads.

You are right that I do not know if it is the .DAT or .MAP file that
is corrupt, but I assumed that because I could see the the road on the
map (via MapX), but could not retrieve any information about it that
meant that the problem was with the .DAT file.  But, my understanding
of these files is not rock solid by any means.

The corruption is almost certainly being caused by my program and I
think has something to do with MapX - because all the changes to the
file are done through MapX.  (MapX 5.0 has a bug that will sometimes
cause access violations when you try to access the X,Y points of a
polyline and I do this quite a bit when splitting or combining road
segments).

> What error message does MITAB 
> return if you call mitab_c_getlasterrorno() after you got -1?

Thanks for the advice about looking at the error return.  I feel
foolish for not thinking of it myself.

Error code: 5
Error Message: "GetNextFeatureId() failed: unable to set read pointer
to feature id 92085"

This helps me quite a bit as now I will be able to distinguish between
a corrupt record and EOF.

I have already written a utility that can create a clean file with the
corrupt records removed, but this is not ideal.  The users don't like
losing roads, but thankfully there's not a lot of users and they are
understanding.

> You could try using the tabdump program...

I will give tabdump a try and see if it provides any more info.

Is there anything else I should be looking at or any way to see in
more detail what is getting corrupted?

Thanks again,

mp







 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/mitab/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to