Salvaging a damaged ArcView project file

Document ID:<DOC_ID36.1804</DOC_ID

Status: Web

Owner:<DOC_OWNERJeff Friestman@6001</DOC_OWNER

Source: Technical Support

Last update:<STATUS_DATE 971114</STATUS_DATE

Product: ArcView GIS Version 3.x

Platform: ALL

Question:

How can I salvage a damaged ArcView project file?

Cause:

A project file may get corrupted by system crashes, or operations that yield one of these errors: Segmentation Violation, Floating Point Exception, Invalid Operation, or Invalid Page Fault. The causes for such situations are varied and are beyond the scope of this document.

Answer:

Given that the extent of the damage to the project file is unknown, as it varies from case to case, there are various options you may pursue to attemp recovering a damaged project file; these are described below.

Before attempting the recovery process, make a copy of the damaged ".apr" file under a different name. This backup copy may be needed to revert to if some of the changes described below do not work.

Keep in mind that an ".apr" file is a type of "odb" file (object data base), and so you can open it and make changes to it using a text editor such as Notepad, Wordpad, and textedit or vi in UNIX.

Basic recovery:

===============

Import the damaged project into a new project. Go to the "Project" menu and choose the "Import", if it opens, you are done. Save this project to a different file name. It is highly recommended that you make and maintain a backup copy of your project file, during the normal course of your work, in the eventuality it becomes corrupt again.

Data oriented project repair:

=============================

If the basic recovery process does not work, it may be that your project file has coorrupt data or wrong data definitions. To determine if this is the case open the ".apr" file in a text editor, and "Find and replace" the drive letter of all the data sources in the project. For example, if all your data is on your hard drive c:\ and a network drive f:\, find c:\ and replace it with a non-defined letter (e.g. z:\). Next, find f:\ and replace it with a different letter. When ArcView reads the ".apr" file and it comes across a data set that it can't find, it will prompt you for the data set. At that point click "Cancel

All."

If the project opens, some of your data sets or the references to the data sets are corrupt. You will need to use a process of elimination to determine which data set is corrupt. Open a the ".apr" file in a text editor and search for the string "Path:". Each object referenced by this string is a FileName object, which provides the source name for the data file. As you search for all occurrences of "Path:", you will notice text lines that look like this:

(FN.958<BR>

Path: "c:/<your_path>/sample.shp"<BR>

Use a textfile, or a piece of paper, to create a list of all data sources, skip duplicate definitions. When you complete the list of all the FileName objects/data sources in your project, you will need to do a "project repair" on each data source to determine which data ArcView is unable to find (refer to page 46 of your "Using ArcView GIS" book). For example, assume that your project file contains the following data paths:

"c:/gisdata/pop_90.dbf"

"c:/gisdata/county.shp"

"c:/gisdata/images/backgrnd.tif"

Find and replace the pop_90.dbf string with something like "testing". When ArcView reads the FileName object referring to "testing", it will pause and ask you to find "c:/gisdata/testing". Click Cancel and see if the ".apr" opens successfully. If it opens, there is something wrong with that data set or a reference to that data set. Save the project without the corrupt data set. If the project still does not open, you will need to test each data set until you find the set or sets that are keeping your project from opening.

Document oriented Project Repair:

=================================

If after removing all the data sets from the project it still does not open, you probably have a corrupt document object. To determine if you have a bad reference in your document list you will again use the process of elimination. Restore the ".apr"file by copying it back from the backup you made in the begin of this session and load it in a text editor. The top of your ".apr" file should look like this:

/3.0

(ODB.1

FirstRootClassName: "Project"

Roots: 2

Version: 30

)

(Project.2

Name: "proj1.apr"

CreationDate: "Thursday, June 12, 1997 07:10:01"

GUIName: "Project"

Win: 3

CSMgr: 4

VisGUIWidth: 70

Doc: 5

Doc: 177

Doc: 143

Doc: 187

Doc: 39

ActiveDoc: 187

Buttons: 378

Buttons: 379

Buttons: 380

Dependencies: 381

Scripts: 382

WorkDir: 1178

WinX: 11

WinY: 4

WinW: 852

WinH: 594

SerialNumber: "555551111111"

SelColor: 1179

GUINames: 1180

GUINames: 1181

GUINames: 1182

GUINames: 1183

GUINames: 1184

GUINames: 1185

GUINames: 1186

The object of interest is "Project.2," which contains this list of document objects::

Doc: 5

Doc: 177

Doc: 143

Doc: 187

Doc: 39

ActiveDoc: 187

To make sure the project can be salvaged at all you need to delete all but one of the document references. It is recommended that you keep the very first document in the list. If you have an Active Document, you need to delete that one as well. Save the project, and reopen it. If it does not open, delete the remaining document, save and reopen the project. If it opens you will most likely be able to salvage most of the project.

Now you need to use the process of elimination on groups of documents to find out which document(s) is (are) causing the project to crash. You will need to take notes so you do not lose track of the documents you will be eliminating. When you remove a group of documents and the project opens, you will know that one or more of these documents that you eliminated are corrupt. If the project does not open, then you can assume one of the douments you left in the ".apr" file is causing it to crash. Use your editor's "Undo" function to restore the document references that were deleted above ,or restore the entire ".apr" file from the backup you made earlier. Select a group of documents to eliminate and continue testing documents until you are certain that none of them are corrupting your project. Once you find the corrupt documents you will need to remove them, save the project, reopen it, and recreate those documents.

Notes:

You can keep the ".apr" file open in the text editor while you run the above tests. I you are on a Windows plataform, and you are not familiar with your text editor, you may want to memorize these key sequences:

Ctrl+Z will Undo your last edit

Ctrl+F is the shortcut to Find (except in Notepad)

Ctrl+H is the shortcut to Find and Replace (except in Notepad)

Esc will dismiss a window

Remember to make and maintain a backup copy of your project file, during the course of your work, in the eventuality it becomes corrupt