Fisheries and Oceans Canada / Pêches et Océans Canada - Government of Canada / Gouvernement du Canada Fisheries and Oceans Canada / Pêches et Océans Canada - Government of Canada / Gouvernement du Canada
 
Français Contact Us Help Search Canada Site
Home What's New DFO National Site Map Media

Fisheries & Oceans
 
 
Maritimes Region
Fishing Industry
General Public
Marine & Oceans Industry
Media
Students and Teachers
Scientists and Researchers
 
AconIcon ACON       Home/Topics   |   Commands

File Conversion


File conversion functions include: Convert XYP to Overlay, Convert Overlay to XYP, Convert Illustrator to XYP, Convert Dos to Mac, Convert Mac to Dos, Convert Commas to Tabs, Convert Blanks to Tabs, Convert_Tabs_to_Blanks, and Convert Text File.

File format specifications include: Internal Overlay File, Header File Format, and Coordinate File Format.


Convert XYP to Overlay

This command allows the user to convert an XYP format file to an Overlay format file. XYP files are ASCII files containing the x axis coord., y axis coord., and pen command (3 move,2 draw, 999 end of file). Overlay files execute much more quickly (especially when "overlayed" using Mercator projection to the screen), than XYP files.

There are 2 parameters:
xyp filename - the name of the existing xyp file.
overlay filename - the name of the new overlay file to create.

Convert_XYP_to_Overlay("XYP file name","Overlay file name");

Convert_XYP_to_Overlay ("C:/AconInput/My XYP file","C:/AconOutput/My Overlay file");


Convert Overlay to XYP

This command allows the user to convert an Overlay format file to an XPY format file. XYP files are ASCII files containing the x axis coord., y axis coord., and pen command (3 = move, 2 = draw, 999 = end of file).

The internal format of Overlay files is such that they are not easily transportable.

Conversion to XYP format produces an ASCII file containing the x,y pen values.

There are 2 parameters:
overlay filename - the name of the new overlay file to create.
xyp filename - the name of the existing xyp file.

Convert_Overlay_to_XYP("Overlay file name", "XYP file name");

Convert_Overlay_to_XYP("C:/AconOutput/My Overlay file", "C:/AconInput/My XYP file");


Convert Illustrator to XYP

This command allows the user to convert an Illustrator 1.1 EPSF format file (originally created by ACON) to an XPY format file. XYP files are ASCII files containing the x axis coord., y axis coord., and pen command (3,2,999).

This conversion relies on an Illustrator PostScript Note attached to a rectangle (usually the axis) within the file. The Illustrator document is opened and scanned to locate an "ACON message" which contains the Window_Number, Data_Window, Data_Viewport, and Data_Projection commands. All line vectors encountered after the note are copied to the output file (in Illustrator terms, these would be non-bezier curves layered on top of the axis rectangle).

Why have this command? This permits Illustrator to be used to edit user coordinates of overlay files (by writing them to an Illustrator File), and restore the x,y values from the Illustrator file.

There are 2 parameters:
Illustrator filename - the name of the Illustrator file to convert.
xyp filename - the name of the xyp file to create.

Convert_Illustrator_to_XYP("Illustrator file name", "XYP file name");

Convert_Illustrator_to_XYP("C:/AconInput/Illustrator_File", "C:/AconOutput/XYP_File");


Convert Dos to Mac

This command allows the user to convert an ASCII DOS file to a Macintosh format file by converting the CRLFs to CRs.

There are 2 parameters:
input filename - the name of the dos file to convert.
output filename - the name of the mac file to create.

Convert_Dos_To_Mac("Input file name", "Output file name");

Convert_Dos_To_Mac("My_Dos_input_file", "My_Mac_output_file");


Convert Mac to Dos

This command allows the user to convert an ASCII Macintosh file to a DOS format file by converting the CRs to CRLFs.

There are 2 parameters:
input filename - the name of the mac file to convert.
output filename - the name of the dos file to create.

Convert_Mac_To_Dos("Input file name", "Output file name");

Convert_Mac_To_Dos("My_Mac_input_file", "My_Dos_output_file");


Convert Commas to Tabs

This command allows the user to convert a comma delimited file to a tab delimited format file.

There are 2 parameters:
input filename - the name of the comma-delimited file to convert.
output filename - the name of the tab-delimited file to create.

Convert_Commas_To_Tabs("Input file name", "Output file name");

Convert_Commas_To_Tabs("My_Comma_input", "My_tabbed_output");


Convert Blanks to Tabs

This command allows the user to convert a blank space delimited file to a tab delimited format file.

There are 2 parameters:
input filename - the name of the blank-delimited file to convert.
output filename - the name of the tab-delimited file to create.

Convert_Blanks_To_Tabs("Input file name", "Output file name");

Convert_Blanks_To_Tabs("My_Blank_input", "My_tabbed_output");


Convert Tabs to Blanks

This command allows the user to convert a Tab delimited file to a Blank space delimited format file.

There are 2 parameters:
input filename - the name of the tab-delimited file to convert.
output filename - the name of the blank-delimited file to create.

Convert_Tabs_To_Blanks("Input file name", "Output file name");

Convert_Tabs_To_Blanks("My_tabbed_input", "My_blanked_output");


Convert Text File

This command allows the user to convert text strings within a text file. The name of the input and output files and the search and replace strings for the changes are specified. A maximum of 4 pairs of search and replace strings (each 50 characters maximum) may be supplied.

There are 4 or more parameters:
input filename - the name of the input file to convert.
output filename - the name of the output file to create.
search string - the character string to be searched for.
replace string - the character string to replace the found string.
...
search string - the character string to be searched for.
replace stringn - the character string to replace the found string.

Convert_Text_File("Input file name","Output file name", "search string", "replace string"...);

/* convert all Carriage Returns to Carriage Return Line Feed */
Convert_Text_File("file1","newfile1", "\r", "\r\n");
/* convert all "*****" to "999" */
Convert_Text_File("file1","newfile1", "*****", "999");
/* convert all "\x07" (Hexidecimal) to "" (nothing) */
Convert_Text_File("file1","newfile1", "\x07", "");


Internal Overlay File

The internal format of Overlay files is such that they are not easily transportable. Conversion to XYP format produces an ASCII file containing the x,y pen values.

For the information of the truly curious, the internal format is as follows:

There are a minimum of 2 files per (logical) overlay file.

"COAST" the name the user provides (the binary header file)

"COAST.BDA" (the binary coordinate file)
"COAST.T1" [Optional file] Mac Mercator Projection Quickdraw Picture File

Binary Header file - 1 record per polyline
Binary Coordinate file - 1 record per coordinate pair
The format of these files follows:


Header File Format

Binary Header file - 1 record per polyline
the format of each record of this file is:
struct wbin {
float xmin; /* 4 bytes - minimum x axis value within this polyline */
float xmax; /* 4 bytes - maximum x axis value within this polyline */
float ymin; /* 4 bytes - minimum y axis value within this polyline */
float ymax; /* 4 bytes - maximum y axis value within this polyline */
long level; /* 4 bytes - value of this polyline [not used] */
long start; /* 4 bytes - record # of this polyline in the coordinate file [origin 1] */
long npts; /* 4 bytes - # of coordinates in this polyline */
} tble;

The byte address of the 1st polyline coordinate = (tble.start -1) * 8 + 1; [1 origin]


Coordinate File Format

Binary Coordinate file - 1 record per coordinate

the format of each record of this file is:
struct cbin
{ float xvalue; /* 4 bytes - the x axis value within the polyline */
float yvalue; /* 4 bytes - the y axis value within the polyline */
} coord;


AconIcon ACON       Home/Topics   |   Commands



Last Modified : 2003-11-19