Contents
How does the mapdocument function in ArcPy work?
The MapDocument function returns a MapDocument object reference to a variable called mxd. The string CURRENT is a keyword used to reference the currently loaded map document. In place of CURRENT, this is where you could also provide a path to the map document.
How does the extract data tool in ArcGIS work?
The Extract Data tool is a convenient way to package the layers in your map into datasets that can be used in ArcGIS Pro, Microsoft Excel, and other products. Extract Data creates an item in Content containing the data in your layers.
What is the string current in arcpy.mapping?
The string CURRENT is a keyword used to reference the currently loaded map document. In place of CURRENT, this is where you could also provide a path to the map document. After typing the dot, you should see a long list of methods and properties available to the MapDocument object.
Can a shapefile be redirected to a geodatabase workspace?
For example, a shapefile called Highways.shp can be redirected to a file geodatabase workspace only if the dataset name in the file geodatabase is also called Highways. Use the replaceDataSource method on the Layer or TableView objects if the dataset name is different.
How to add layers to an arcpy.mapping document?
A common scenario is to author a template map document with no layers, then use the arcpy.mapping AddLayer, AddLayerToGroup, or InsertLayer functions to add layers to the map document. If a legend element is pre-authored to automatically add new items to the legend, the legend items will appear automatically.
How to export arcpy.mapping to a PDF document?
The following is a very simple example of how arcpy.mapping can be used to reference an existing map document and export it to a PDF document with only two lines of code. mxd = arcpy.mapping.MapDocument (“C:/Project/Watersheds.mxd”) arcpy.mapping.ExportToPDF (mxd, “C:/Project/Output/Watersheds.pdf”)
How to reference a map document in ArcGIS?
There are two ways to reference a map document. The first is to reference it on disk by providing a path to the .mxd file. If you are building a script that is to be run outside the ArcGIS environment, you must reference a map document using its path.
How to get started with arcpy.mapping in Python?
Drag the Python window to the docking anchor located at the bottom of the ArcMap application and release the button. Click in the code pane (with the >>> characters) of the Python window. You should see some help text appear in the help pane to the right.
Where is the best place to learn ArcPy mapping?
The easiest place to start learning arcpy.mapping is in the Python window. The Python window is part of the ArcMap framework and provides autocompletion so you can easily read the names and order of the function parameters.
Where do I put the ArcPy file in Python?
The installation will also add the file Desktop10.3.pth (or Engine10.3.pth or Server10.3.pth) into python27\\Lib\\site-packages. The contents of this file include two lines containing the paths to your system’s ArcGIS installation’s arcpy and bin folders.