Recently I have been making scripts to run geoprocessing tools for a client who is running ArcGIS 9.3. However I only have access to ArcGIS 10.1. As a result I cannot use model builder in 10.1, and have to script everything with arcgisscripting (import arcgisscripting
). I cannot find many arcgisscripting examples beyond the 9.3 help files.
My questions are: is there a way to reverse convert 10.1 (arcpy/modelbuilder) scripts to 9.3? Is there a place with good arcgisscripting .py examples? Has anyone else done this?
3 Answers 3
Unless you are using geoprocessing tools that are exclusive to 10.1, you should be able to convert it backwards. First export your model to python from model builder. then change
import arcpy
to
import arcgisscripting
next set a variable to the arcgisscripting module you imported
gp = arcgisscripting.create()
after that you need to import your gp toolboxes
gp.AddToolbox("C:/Program Files (x86)/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")
after that do a find/replace and change arcpy to gp
arcpy.Intersect_analysis()
to
gp.Intersect_analysis()
i converted a bunch of 9.3 scripts to 10 using the reverse of this method and did not have any issues
As @Zachary mentioned, the key is:
- using tools that are available in both 10.1 and 9.3 at the same license level (don't forget that some tools changed license from 9.3 to 10.1)
- change "import arcpy" to "import arcgisscripting"
If you really wanted to be sneaky, though, instead of creating a new variable called gp, from: gp = arcgisscripting.create()
and then having to find/replace arcpy to gp, I THINK you should be able to simply set your new variable with the name arcpy = arcgisscripting.create()
, and the rest of the tool references should just work.
-
I believe you are correct about the variable name. That would be a quick, efficient way to update the script.Zachary– Zachary2013年02月06日 12:05:27 +00:00Commented Feb 6, 2013 at 12:05
arcgisscripting (ArcGIS 9 Python) isn't as full featured as arcpy (ArcGIS 10 Python) This forum has a lot of discussion of both ArcGIS Python modules
Explore related questions
See similar questions with these tags.