Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been scouring the internet trying to find a pythonic (sp?!) way to process this data..

Everyday we will recieve a load of data in .dbf format (hopefully) - we then need to save this data as a shapefile.

Does anyone have any links or any suggestions as to my process?

share|improve this question
Im running armap 9.3.1! – Alice Feb 18 '11 at 11:24

Alice, Don't forget to assign a spatial reference to your xy layer! Or you can do it to the output feature class using

gp.DefineProjection_managment(Output_Feature_Class, coor_system)
share|improve this answer
Thank you rob!! – Alice Feb 25 '11 at 9:05
The "MakeXYEventLayer_management" contains a parameter for projection. – jonatr Apr 4 '11 at 6:54
up vote 3 down vote accepted

It was in model builder all along!

#   (generated by ArcGIS/ModelBuilder)
# Usage: DBF2SHAPEFILE <XY_Table> <Y_Field> <X_Field> <Output_Feature_Class>
# ---------------------------------------------------------------------------

# Import system modules
import sys, string, os, arcgisscripting, datetime

# Adds the creation date to all of the previous shapefiles in that folder
filename = 'D:/test.txt'
fileinfo = os.stat(filename)
creation_date =
os.rename(filename, filename + '-' + creation_date.strftime('%Y-%m-%d'))

# Create the Geoprocessor object
gp = arcgisscripting.create()

# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")

# Script arguments...
XY_Table = sys.argv[1]

Y_Field = sys.argv[2]

X_Field = sys.argv[3]

Output_Feature_Class = sys.argv[4]

# Local variables...
Layer_Name_or_Table_View = ""

# Process: Make XY Event Layer...
gp.MakeXYEventLayer_management(XY_Table, X_Field, Y_Field, Layer_Name_or_Table_View, "")

# Process: Copy Features...
gp.CopyFeatures_management(Layer_Name_or_Table_View, Output_Feature_Class, "", "0", "0", "0")
share|improve this answer

This is not python as requested, but this will run a macro in visual basic. Macros > Visual Basic Editor.

Possible arcpy script (though publisher is not supported in arcpy):

share|improve this answer
Arcpy isn't there at v9.3.1. – DavidF Feb 18 '11 at 19:34
It turns out i was described the problem incorrectly - its not the .pmf we need to update it is the shapefile! Which we then need to export to the client - do you have any links for this? – Alice Feb 21 '11 at 8:44
ive edited my question with all of my new found problems! – Alice Feb 21 '11 at 8:55

This can't be done in Python. See the following help document for code examples of how to do this:

share|improve this answer

How about this:

  1. Read your dbf file into memory with this dbf reader and writer

  2. Iterate through the dbf records and bring them into a shapefile with something similar to Listing 9 in this ArcUser article.

share|improve this answer

Your Answer


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.