How to convert csv to shapefile using arcpy ?

12637
3
01-29-2013 05:51 AM
KushBhusal
New Contributor
I want to convert csv files to shapefile using arcpy. I've got hundreds of csvs (with multiple fields) that i need to convert. There are two different lat long columns(normal lat long and delayed lat long) within the csv files and i want to use delayed lat long values. Trying to do this in arcpy but haven't been successful so far.

Any help will be appreciated !


Thanks
Tags (2)
0 Kudos
3 Replies
JamesCrandall
MVP Frequent Contributor
You can start here, but I am not sure if you will need additional tweaks for the .csv format (this page shows ex with .dbf):

http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000006z000000
0 Kudos
KushBhusal
New Contributor
Thanks James....I am trying using the example in link you gave, but for some reason i am getting parsing error. I initially tried by substituting .dbf with .csv, but maybe some more tweaking needs be done.
0 Kudos
JamesCrandall
MVP Frequent Contributor
Oh, this is my bad.  It has been a while since I implemented this, but I incorporated a 3rd party Python library to setup a table with a csv source -- this maybe a bit much for your requirements.  How about if you invoke Table To Table to bring in the csv into a .gdb (like in your scratch workspace or something), then use that table in the MakeXYEventLayer method.

Import .csv into gdb:
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001200000027000000

MakeXYEventLayer:
http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000006z000000

Sorry I don't have a specific example for you, maybe someone else can post up their solution.

James
0 Kudos