Dumb question - can I write standalone python script to run without arcgis?

7071
31
05-18-2010 11:54 PM
jimparsons
New Contributor III
I need to open a raster, thin it, and save it. Can I do that in a script outside of arcgis, or does arcgis need to be running for the script to work? I have it installed on the system, so it would obviously be running on my computer.

Sorry this question is really simple. I don't really understand how to run a script outside of arcgis...or even if it's possible. I'm hoping someone will say yes or no! Thanks
0 Kudos
31 Replies
ToreBorvik
New Contributor III
nope. You do not need to have arcgis open, you can call geoprocessing from within the script.
0 Kudos
KoenVolleberg
New Contributor
I believe it is possible. Just write a Python script as if it were run from within ArcGIS.
Run it from within a dos-prompt: <name_script.py> <param1> <param2>...

Works for me, so I think it should work for you as well. But only just as long you have ArcGIS installed.
Cheers, Koen
0 Kudos
RDHarles
Occasional Contributor
Absolutely, I run all my python scripts without ArcMap open, from a command line.
0 Kudos
JoelCalhoun
New Contributor III
Another way to run them outside of ArcGIS or the command prompt is just to open them in an IDE (python editing program) and run them from there.
0 Kudos
jimparsons
New Contributor III
Thank you. I find the model builder great for building, but not great for naming the files that inevitably crop up. I use the scratch space thing, but I think I could do a better job programmatically creating new folders based on time and date. I'm pretty confident I can do that in python...
0 Kudos
jimparsons
New Contributor III
Here's another kinda dumb question. How hard would it be to write a script to:

do
zoom to layer for each raster in document
file -> export map based on current extent
loop for each raster in doc

With python it's easy to access the toolbox, but how would we access a) the zoom to layer command, and b) the file export map tool, which is a very handy way to effectively merge lots of 24 bit color rasters simply by opening them all and exporting the overall map at great resolution.

In this instance I want to zoom to layer of each one so I can export them as a geotiff, not as tif + tfw as they are at the moment.

I have no idea how difficult the above job is. Can anyone tell me? Thanks
0 Kudos
ToreBorvik
New Contributor III
Not easy at least. I've not succeeded in making arcmap zoom around in a document from a script. But I'm no script pro..
0 Kudos
jimparsons
New Contributor III
Life would be much easier if we could record batch macros like in Photoshop.....without having to write arcobjects script.
0 Kudos
JoelCalhoun
New Contributor III
ArcGIS 10 will include arcpy.mapping.  It will allow for the maipulation of layer files, aspects of the layout, map
automation, and export with Python.  The added functionality might enable you to do what you want.
0 Kudos