Python Help Page
python help page
10 Easy Ways to Tame Python Scripting in ArcGIS
Python, or even scripting in general, can seem like a scary thing to those who have no background in computer languages. Even though it might seem difficult, there are many times where automating common workflows can be very helpful in speeding up the monotonous parts of GIS that we all have to do.
These 10 tips are some basic ways to learn Python and get you more comfortable using scripts. I myself had no background in scripting or programming before working at Esri. I have used all of these tips to gain the confidence and practice I needed to help support customers. And I still use them today!
Python for Bioinformatics (Chapman & Hall/CRC Mathematical & Computational Biology)Learn more
Sebastian Bassi
- Understand the basics of Python's syntax rules.
It's always helpful to get to know the language before you use it. See these links for more information on the Python language and syntax.
Sometimes there is nothing better than taking a course. Whether it's self-paced or instructor led, it is good to see practical examples of how to use scripts in ArcGIS.
The online web-help offers many pages on Python, from classes and methods (in the ArcPy site package section) to samples of how a tool can be run from a script. This is a great place to start looking for how specific tools should be called up. Check out these links for a taste of Python in the web-help.
Learn more
Sylvain Hellegouarch
Check out the official Geoprocessing Blog for posts from the Esri Geoprocessing Development team, including tips on using Models and Python scripts. Samples are included on some of the posts as well.
Discuss issues and problems with other ArcGIS Python users.
Check out what others have made, find the custom tool of your dreams, or upload your own python script tools and documentation at the Model and Script Tool Gallery.
Python scripts are basically text files with a .py extension. You could write your script in notepad, but why do that when you can use an interface that will give you some extra writing help.
IDE's are interfaces that help in script writing. Two common IDEs are IDLE and PythonWin. IDLE is automatically installed when you installed ArcGIS Desktop.
The Python Window, new at ArcGIS Desktop 10.0, allows you to use and test code within an open ArcGIS session. This is helpful when you want to see an end process say in ArcMap.
This is a great place to start practicing syntax and parameter use. Build your model and then export it to python. Take a look at what is going on then modify the script to fit your needs.
Not sure what to write a script for? Ask someone for a workflow they want to automate then write a script. After the script is ready you can import it into a Geoprocessing tool for easy use.
Using additional code to your script can help extract useful messages from failing codes. Tracebacks will allow you to take a look at where in the script exceptions are raised.
0 コメント:
コメントを投稿