Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

How do I convert a text file with point coordinates to database tables in the Dbase.dbf format in Python?

share|improve this question

2 Answers 2

you can use Table to Table (Conversion) more details here or Copy Rows (Data Management) here. both of them have a very similar structure...

Usage of Table to Table:

This tool supports the following table formats as input:
    dBASE (.dbf)
    Comma Separate Value (.csv)
    tab delimited text (.txt)
    Microsoft Excel worksheets (.xls or .xlsx)
    INFO
    VPF
    OLE database
    personal, file, or SDE geodatabase
    in-memory table views

For file input (.csv or .txt), the first row of the input file is used as the field
names on the output table. Field names cannot contain spaces or special characters 
(such as $ or *), and you will receive an error if the first row of input file 
contains spaces or special characters.

Syntax

TableToTable_conversion (in_rows, out_path, out_name, {where_clause}, {field_mapping}, {config_keyword})

Example:

import arcpy
from arcpy import env
env.workspace = "C:/data"
arcpy.TableToTable_conversion("inputFile.txt", "C:/output/Dbase.dbf", "outputFile")

i hope it helps you...

share|improve this answer

As you're using ArcGIS, Aragon's answer should be sufficient. However, you can do it without ArcPy too. Python has a module for reading CSVs. You can then use dbfpy to write out the DBF. I believe there is a PyPi module for reading and writing to XLS, which might also serve.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.