Monday, January 9, 2012

Import a CSV text file into gvSIG

Text files formatted as CSV (comma separated values) are a common data transfer method from system to system. In gvSIG, it is possible to import the CSV files into a binary DBF file through an easy to use graphical interface. Instead of calling the function as Import CSV or something to that order, gvSIG uses the term Normalize Text File.

An example of importing a CSV file into a binary .dbf file is illustrated below.

  1. Start up gvSIG OADE. Open up a View.
  2. Select Table | Normalize text file.

    The Load text file dialog box appears.

  3. Browse and select a CSV file e.g. C:\temp\test.csv. Click Open.

    The Normalization dialog box appears. By default, a new field entry named as NewField is listed.

  4. Click the NewField field. In the Field name field, change the value to a suitable name e.g field1.
  5. In the Separators group box, toggle on Other and type in a comma: ,.
  6. Click the + button.

    A new field NewField2 is added to the list box.
  7. In the Field name field, change the value to a suitable name e.g. field2.
  8. Repeat the previous steps 4 to 7 for each field.


  9. Click Test run.

    A preview of the normalization is displayed in the Sample output field.
  10.  If the preview shows the values have not been separated properly, trace back the previous steps and correct any errors.
  11. If the preview shows the values can be separated properly, click Run.

    The New table dialog box appears.

  12. Browse and type in a new file name e.g. C:\Temp\ImportTest.dbf. Click Save.

    The text file is imported and displayed.



No comments:

Post a Comment