ImportCSV()
Summary
Imports features from a Caliper text geography file into a geographic file.
Syntax
ImportCSV(string filename, string new_db_name, string layer_type, array options)
| Argument | Contents |
|---|---|
| filename | The path and file name of the file to import |
| new_db_name | The path and file name of the new geographic file |
| layer_type | The type of features to import: Point, Line, or Area |
| Option | Type | Contents |
|---|---|---|
| Direction | Integer | The field position of the link direction (only when importing a line layer); defaults to no direction information present |
| Geography | Integer | The field position for the start of the geographic information; i.e., (lon, lat) for point layers and (np, lon1, lat1, _) for line and area layers (defaults to 1 for point and line layers and 3 for area layers, or immediately past the last defined ID field) |
| ID | Integer | The field position of the item ID(s) (defaults to 1 for area or line layers and no ID present for other layers) |
| Label | String | A descriptive label for the geographic file |
| Layer Name | String | The name of the layer in the geographic file |
| Median Split | Boolean | If "True" special handling ensures that entities which cross the 180 degree longitude line are imported properly; if "False" (the default), no special handling is invoked |
| NAD Conversion | 3 strings | Input datum, output datum, and conversion file (if needed); the input and output datums should be different |
| Node ID | Integer | The field position of the start node ID; the end node ID must immediately follow (only when importing a line layer) (defaults to no node IDs present) |
| Node Layer Name | String | The desired name for the endpoint layer (only when importing a line layer) |
| Optimize | Boolean | Whether to optimize the geographic file automatically after the import (defaults to "True") |
| Projection | String, array | The projection name and the array of options |
| Transform | Array | Array specifying the coordinate transformation to apply to the file. This array can take one of three forms: (1) Control Point Transform an array of two or more four-element arrays containing local and world coordinates for control points. Example: {{real localX1, real localY1, real longitude1, real latitude1}, ...}. (2) Affine Transform an array of four elements: {real X_multiplier, real Y_multiplier, real X_offset, real Y_offset}. (3) Center and Extent Transform {c1_x, c1_y, width_1, c2_x, c2_y, width_2}, where the center shifts from (c1_x, c1_y) to (c2_x, c2_y), and a vector of length width_1 from c1 becomes a vector of length width_2 from c2. |
Notes
-
For more details on the NAD Conversion option, see Datum Conversions.
-
For more details on the Projection option, see Using Projections and Coordinate Systems.
-
If no transformation is applied, longitude and latitude coordinates can be integers with six implied decimal places (millionths of a degree). For more details, see Transformations.
-
ImportCSV() displays a progress bar. To add a Cancel button to the progress bar, precede the function call with an "on escape" clause. For more information, see Error Handling.
Example
ImportCSV("c:\\geofiles\\sample.GEO", "streets.dbd", "Line", {
{"Direction", 4},
{"Geography", 5},
{"ID", 1},
{"Node ID", 2},
{"Label", "Street Centerline File"},
{"Layer Name", "Centerline"},
{"Optimize", "True"},
{"Projection", "utm", {"zone=12", "units=m"}},
{"NAD Conversion", "NAD27", "NAD83",}
})
Error Codes
| Error Type | Meaning |
|---|---|
| NotFound | There is no file by this name |
| Error | The file is not a valid Caliper text geography file |
| Escape | The user clicked Cancel |
See Also
| Function | Summary |
|---|---|
| ExportCSV() | Exports features in a geographic file to a Caliper text geography file |