Dear all, I have several thousand files in dBaseIV format that I need to convert to shapefiles for use in ArcGIS. I've written a script (see below) to automate this process but thus far have been unable to get it to work. I suspect that there's a simple reason for this, but I'm a complete novice with Python and have been unable to find it.
Any help would be greatly appreciated! Regards, Chris Bromley ##Script Name: dBase Table to Shapefile ##Description: Converts dBase files to shapefiles ##Created By: Chris Bromley. ##Date: 16/02/2005 # Import system modules import sys, string, os, win32com.client # Create the Geoprocessor object gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1") try: # Load required toolboxes... gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx") gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx") #Define & create variables to contain the source files and output file location paths gp.workspace = "C:\PhD\ElwhaRiverProject\Physical_modelling\Model_Data_Corrected\Tester3\One" out_workspace = "C:\PhD\ElwhaRiverProject\Physical_modelling\Model_Data_Corrected\Tester3" # Get a list of the dBase tables in the workspace fcs = gp.ListTables("*","dBase") # Loop through the list of feature classes fcs.reset() fc = fcs.next() while fc: # Set the output filename for each output to be the same as the input filename output = out_workspace + fc # Process: Make XY Event Layer... gp.MakeXYEventLayer_management(fc, "x", "y", output, "") # Process: Feature Class To Shapefile (multiple)... gp.FeatureClassToShapefile_conversion(output, out_workspace, ) fc = fcs.next() except: gp.AddMessage(gp.GetMessages(2)) print gp.GetMessages(2) This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor