Python Performance Vs Model or Manually

3789
4
11-26-2013 05:23 AM
TerryScott
New Contributor
Hi  I'm new to ARCGIS and Python and I've written several python scripts to automate some of the regular nightly data extraction.    This very simply script takes 2-3 hours to run when I can manually accomplish the same task in 2-3 minutes or in a model I built in 12 minutes.

I am simply trying to open a text file and save it as a Shape file.  the text file has Civic Address coordinates in it.     I created a model and it ran in 12 minutes so I exported it to a python script so I could schedule the task.    It now takes 2-3 hours to run.

Here's the code.   any ideas why it is taking this long.   I compared it in a 32 bit and 64 bit environment.

[INDENT][INDENT]import arcpy
from arcpy import env

##   create Ca_Points.

arcpy.env.overwriteOutput= True

env.workspace = "c:\\geolinc"

   
env.workspace = "n:\\tel_update"

arcpy.MakeXYEventLayer_management("master_ca.txt", "X_COORD", "Y_COORD", "ca_points","",)
arcpy.FeatureClassToShapefile_conversion(["ca_points"], "c:\\geolinc")[/INDENT][/INDENT]
Tags (2)
0 Kudos
4 Replies
SachinKanaujia
Occasional Contributor III
What is N: drive? Is it a local drive or a mapped network location?

env.workspace = "n:\\tel_update"

I wanted to understand the complete scenario? How many records are there is your text file and you were able to run the complete process including conversion to shapefile manually in couple of seconds?
0 Kudos
TerryScott
New Contributor
Hi There is 71,000 records with about 25 fields.    Not a huge dataset by any means.

N:\tel_update is a network path to the file.   I've tried it locally with not much of a difference.

If I run the complete scenario in ARCMAP manually it takes about a minute.   I'm just importing X/Y data then exporting it as a shapefile.

thanks
0 Kudos
SachinKanaujia
Occasional Contributor III
Can you try this? Also in the script add a Coordinate Reference system when creating points based on the points you have in your text file. I am assuming that its in WGS84?

import arcpy
from arcpy import env

## create Ca_Points.

arcpy.env.overwriteOutput= True
env.workspace = "c:\\geolinc"

# Process: Make XY Event Layer
arcpy.MakeXYEventLayer_management("master_ca.txt", "X_COORD", "Y_COORD", "ca_points", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119522E-09;0.001;0.001;IsHighPrecision", "")

# Process: Copy Features
arcpy.CopyFeatures_management("ca_points", "capoints_output.shp")
0 Kudos
BillRose
New Contributor III

Did you ever solve this?

0 Kudos