Contents
Can you use ArcPy to rename MXD layers?
I have a MXD with some layers that have parentheses in them. I’d like to rename them via script. Is this a valid approach?
How to rename copy layer in ArcMap TOC?
All output Feature Layers will be added to a specified group layer. The following code almost achieves this, but if I then try and change the name of the copied layer (via ArcPy), the names of both the original layer in the TOC, and the copy of that layer (now in the new group layer) are changed.
How does the addlayer button work in ArcGIS?
AddLayer is an easy way to add a layer or group layer into a map document. It can add a layer with auto-arrange logic that places the new layer in a data frame similarly to how the Add Data button works in ArcMap; it places the layer based on layer weight rules and geometry type.
How to create a new layer in ArcPy?
Create a layer of it, change the layer name and other properties you want and then add it to the map. You’ll have to create a new layer from the layer file every time before adding it to the map but it worked for me. Something like this. Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
Do you need to open ArcGIS to open MXD?
What I want to fulfill is, that I don’t need to open ArcGIS again for starting the new mxd and instead of this open the new mxd in the current ArcGIS session. Does anybody have experience with this and can help me?
Can you save an open MXD in Python?
You cannot save an open MXD from a python IDE external to ArcGIS. You can, however, make changes to and save an MXD using Python from ArcMap itself. Open the python window (or you can attach to a script tool if you prefer) and run your python from inside the open MXD.
Is there a way to open a document in ArcPy?
As such, there’s no real functionality for opening and closing documents in the active application. You might be able to do something like this if you used ArcObjects instead, though.
How to add group layers in ArcPy / Python?
Adding group layer, renaming it from folder name, then adding layers to it from that folder, using ArcPy/Python? I am trying to use os.walk to go through a directory tree, pull out all the .shp files in it, create a grouplayer in the mxd, rename the grouplayer the folder name, then add the layers from that folder to the group.
What happens when you rename a layer in ArcGIS?
This tool does not rename layers, since a layer is a reference to a dataset. Rename does not rename fields in the dataset. For example, suppose you have a field named ROADS_ID on a feature class named Roads. Renaming the Roads feature class to Streets does not rename the ROADS_ID field to STREETS_ID.
How to make a copy in ArcMap TOC?
Using ArcPy to copy layer in ArcMap TOC, rename copy, and paste back to TOC? How do I make a copy of a layer in the ArcMap TOC (passed to my script as a Feature Layer), assign the copy a new name, set a definition query on it, and then add the copied Feature Layer back into the TOC?
How does the copy tool in ArcGIS Pro work?
The Copy tool does not copy layers, since a layer is only a reference to a feature class. Copying a mosaic dataset copies the mosaic dataset to the designated location; the images referenced by the mosaic dataset are not copied. The Copy tool does not support .mrf image format.