From the course: Learning ArcGIS Python Scripting

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Writing a script that uses ArcPy

Writing a script that uses ArcPy - ArcGIS Pro Tutorial

From the course: Learning ArcGIS Python Scripting

Writing a script that uses ArcPy

- [Instructor] Let's see how to write a script that uses this arcpy.mp module. First, we'll write a script to access an ArcGIS Pro project, and then we'll add to it to get one of the maps in the project and look at its properties. To get to a project, you have to create the project object. It starts like this. The ArcPy site package has an mp module, and the mp module has an ArcGISProject method. The method takes the fully qualified filename of the project as input. The ArcGISProject method creates the project object, which you need to grab hold of in a variable. So you import ArcPy and then use arcpy.mp.ArcGISProject to create the object. So this object, again, it's an open connection to the project, so now you can get to everything in that project and you store that object as a variable. For the rest of the script, instead of referring to the project by its actual name, you refer to it by its object name, that variable that you created. The project name is just a text string, so it…

Contents