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 written a python script that does some euclidean allocation. For that I use method. Now, my python script takes 30-40% extra time than spatial analyst euclidean allocation tool., out_allocation_raster_name, "", "", cellSize, "VALUE", out_distance_raster_name, "")


Is there any process that help me to improve the running time of this method? Is there any environment setting issue?

share|improve this question
By any chance, are you running in a Python IDE? Many Python IDEs' debuggers actually slow down the execution of Python code. – Jason Scheirer Oct 2 '12 at 4:46
I am using windows default command prompt and c# process to run the python file – Emi Oct 2 '12 at 4:58
How big is the dataset you're working with? – om_henners Oct 2 '12 at 5:16
uncompressed size of the raster data set is: 10.51 MB – Emi Oct 2 '12 at 10:29
I had even stranger issue - my analysis ran perfectly using GUI, but never managed to push it through scripting. – radek Oct 2 '12 at 11:18
up vote 6 down vote accepted

I know where I work, simply typing 'import arcpy' into IDLE or a python command line will take 1-2 minutes. I'm not sure everything that goes on behind the scenes, but I imagine it has a lot of code/libraries to load and it has to check your license. When you run the tool inside of Arc, whether through the Arc python command line or the arc toolbox, or model builder, ArcGIS is already loaded, so that overhead is not there.

Does your C# process run the python script multiple times? If so, there is overhead in importing the arcpy libraries when using python outside of ArcGIS, so if you are running the script multiple times I would imagine you would incur that additional overhead multiple times.

share|improve this answer
My c# process runs the python script once. Is there any way to improve the running time or shortening the overhead? – Emi Dec 10 '12 at 3:07
How much extra time are you taking in actual minutes/hours? The overhead I'm taking about should be a flat 1-2 minutes at most on top of the normal running time. – MWrenn Dec 11 '12 at 19:38
Don't you think 1-2 minutes extra time for a 1-1.5 minutes process, a huge time? – Emi Dec 13 '12 at 6:53
I would guess that your next step then is to look into speeding up your ArcGIS start time if that 1-2 minutes is unacceptable. here's a previous question I found related to getting Arc to start quicker… – MWrenn Dec 13 '12 at 16:19

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.