updated: 23-Jan-2012
Copan Lite
Import and Export
Contents
1. Importing and Exporting Text Files
Tabulated plain text files can be used both as a source of data for, or as a destination from, an open coordfile.
The files can be in delimited (CSV) or fixed format.
Text File Format
To be compatible with Copan, such a text (or Ascii) file must have the following:
-
Any name, though names with .txt, .asc or .csv extensions are advisable.
-
Single-byte character encoding, such as ANSI, DOS or UTF-8.
Note: multi-byte character encodings (such as Unicode or UTF-16) will not work.
-
An optional heading line, at the top.
-
One record per line, each record representing a point.
-
Various fields per record, some of which must correspond in type, but not necessarily in order, to Copan point record fields.
(See Point Record Fields in § Point Records.)
-
Fields formatted in one of two ways:
- Delimited, with fields separated by a single character
(e.g., comma, space, or tab); or
- Fixed, with fields aligned in specific column positions.
- The same field count, order, and format for each line.
The rules for Delimited Format files are similar to those for Excel's CSV files:
-
Fields must be separated by the delimeter character (e.g., a comma-delimited P-N-E-Z line might be
3,1234.56,3456.78,90.12).
-
Unless the space character is the delimeter character, spaces may accompany the separators for human readability (e.g.,
5, 1234.5, 3456.7, 90.1 would be interpreted as 5,1234.5,3456.7,90.1).
-
An imported field may be surrounded by double-quotes (e.g.,
"7",123.4,"345.6",9.0 would be interpreted as 7,123.4,345.6,9.0).
-
Exported alphanumeric fields may be surrounded by double-quotes (see next two items) but numeric fields—point number and coordinates—are not.
-
A field may contain delimiter characters as part of it's value, if so, the field must be quoted (e.g., the Note part of a line might be
"OIP, bent" and would be interpreted as the single string OIP, bent).
-
A field may contain double-quote characters as part of it's value, if so, the field must be quoted and each internal double-quote must be preceded by a double-quote (e.g., a Note might be
"""gold"" tag" and would be interpreted simply as "gold" tag).
Example 1: Comma-delimited text file, three columns, no headings.
1,5699.4,695.2
2,5700.6,695.7
3,5700.0,696.3
4,5699.3,696.1
Example 2: Fixed-field text file, four columns, with headings.
Number Northing Easting Code
1 5699.4 695.2 0
2 5700.6 695.7 8
3 5700.0 696.3 7
4 5699.3 696.1
Example 3: Comma-delimited text file, six columns, with headings.
This is a hypothetical GPS data file, whose second and third fields do not correspond to Copan fields.
Point,UTC,Fix,Northing,Easting,Elev
1,155757,3,6306918.388,380793.430,3.07
2,155758,3,6306918.360,380793.445,3.07
3,155759,4,6306918.358,380793.449,3.09
4,155800,4,6306918.355,380793.444,3.08
Example 4: Bar-delimited text file, with strange notes.
This file
Point|Northing|Easting|Note
1|918.3|179.0|wall
2|618.6|180.5|"non |_ corn"
3|594.3|179.9|wall
4|901.8|193.4|"6"" pipe"
would be interpreted as
Number Northing Easting Note
1 918.3 179.0 wall
2 618.6 180.5 non |_ corn
3 594.3 179.9 wall
4 901.8 193.4 6" pipe
To Import a Text File
-
CoordFile | Import from Ascii...
-
Optionally Load... a Configuration file.
-
Indicate which Ascii file Fields to import to what point record fields.
(See Point Record Fields in § Point Records.)
The chosen point record fields must include at least Number and Elevation, or Northing and Easting.
If an input file has fields that are not desired, choose the blank field for them.
(So to import example file 3, above, choose Number, blank, blank, Northing, Easting, and Elevation.)
-
Choose either Delimited or Fixed format.
(See Text File Format above.)
-
Choose which Points to import: All or Filter.. a subset.
(See § Point Filters.)
After a potential import record has been converted to Copan point format according to your formatting criteria,
it is tested against the import filter before actually being saved to the coordfile.
-
Optionally Apply Transformation to the points being imported. (The source text file will not be changed.)
Clicking Yes... allows you to enter the transformation parameters (see § Coordinate Transformations.)
-
Choose other options as appropriate, such as
whether Headings are on the first line,
whether to Renumber new points or replace existing points
(see § Point Renumbering or Replacement), or
whether to use a Moving Filter (see below).
-
Optionally Save the Configuration for later reuse.
-
Optionally Open to edit, or List to preview, the prospective input file.
-
Import (also labelled OK) and specify the appropriate input file.
To Export to a Text File
-
CoordFile | Export to Ascii...
-
Optionally Load... a Configuration file.
-
Choose which Fields to export to the Ascii file.
(See Point Record Fields in § Point Records.)
You may output Desc, Description, or Extension fields, as well as or instead of Code, but be sure to select a valid
Codes Table which should contain a Desc, Description, and Type for each Code.
(See § Point Codes.)
-
Choose either Delimited or Fixed format.
-
Choose which Points to export: All or Filter.. a subset.
(See § Point Filters.)
-
Optionally Apply Transformation to the points during export. (The coordfile will not be changed.)
Clicking Yes... allows you to enter the transformation parameters (see § Coordinate Transformations.)
-
Choose other options as appropriate, such as whether to Put headings on the first line,
Append to file, if it exists (the default is to overwrite), or
the number of Decimals to output.
-
Optionally Save the Configuration for later reuse.
-
Export (also labelled OK) and specify the output file.
-
Optionally Open to edit, or List to review, the output file.
Notes
-
A Configuration file has any name, preferably with a .cfg extension.
-
The OK (Import/Import) button becomes disabled if ever there is an incomplete set of options (such as not enough chosen fields).
If ever you get in a muddle, you can always revert ot the default Configuration via the Factory button.
-
The number of Decimals to output is local to this module (i.e., the setting doesn't affect other modules).
You may wish to export at a higher precision than normal.
-
The Moving Filter boxes allow you to specify the parameters of a spatial filter—to reduce the number of points imported from a densely-sampled stream of points. A point is accepted only if it lies at or outside a distance of, and/or at or outside a rise/fall of, the previously accepted point. (For any given distance and rise/fall, choosing and instead of or can result in slightly fewer points passing the filter.)
-
The Start and Width boxes for Fixed Format fields should correspond to the first character position and the character count for the field, along a line of character data.
2. Importing Copan Coordfiles
- CoordFile | Import from Copan PTS...
3. Exporting to Total Station Files
If you wish to export points directly to a total-station-compatible file,
see § Export to Total Station File.
updated: 23-Jan-2012