Arcpy.mapping is a Python scripting module that is part of the ArcPy site package.

learn more… | top users | synonyms (1)

2
votes
1answer
29 views

Searching for value in layer without opening MXD file?

As part of the validation for parameters of a Python toolbox, I need to check if the text in parameter #1 is exists in a layer in a MXD file selected as parameter #2. Currently, I use this code in ...
1
vote
1answer
22 views

How can I set X/Y shadow offset values to 1 and -1 in the advanced text window?

I'm trying to use a label expression with ArcGIS formatting tags to create a shadow on my text. I've done everything I need except assigning a value of 1 to X offset and a value of -1 to Y offset. ...
0
votes
1answer
61 views

Is there a script to Python for Click to toggle selectable?

I cannot write a script using ArcPy (Click to toggle selectable). To make a layer unavailable for sampling! I just need to create a tool to automate several processes, one of them is the ability to ...
0
votes
2answers
37 views

mapping.mapDocument() not working, but not throwing exception. path issue?

I'm working through the recipes in the Python cookbook, and am having some weird results. When I run the script (copied below) with the map reference listed as "CURRENT" from an open mxd from the ...
1
vote
1answer
39 views

Changing Field Visibility with Arcpy

I have the same problem stated here: https://geonet.esri.com/thread/98493 When I set the visibility of a field to HIDDEN, the field will not become hidden. l = arcpy.mapping.Layer("myLayer") desc ...
2
votes
1answer
38 views

Changing highlight property of layer or table field using ArcPy?

I need to highlight a field of a layer. With ArcMap it is accessed from Fields property page of a layer. From there one can reorder, hide and highlight the fields. I couldn't find a property or ...
3
votes
0answers
43 views

arcpy, ExportToSVG using paths

I want to export part of the map into (very big) SVG file. First I tried to do this using REST API: https://*server*/ArcGIS/rest/services/General/Etages/MapServer/export. This worked, the SVG file ...
2
votes
1answer
35 views

script to draw a square where the raster pixels contained within are a certain type and greater than X

I have a raster containing different pixel values and I am interested in having squares drawn around areas that are at least X m^2 and containing at least Y type of pixels. The data looks like this, ...
0
votes
1answer
24 views

Select by attributes from a series of feature classes

I have 16 feature classes. What I want to do is to select by attributes each feature class using this statement: "Shape_Area" < 1100 Is there a way to do this by batch using arcpy or ...
2
votes
1answer
50 views

Automating update of network dataset in ArcGIS Server

I am trying to set up an automated process that does a nightly extract of the network dataset from SDE and publish to: ArcGIS Server 10.3 as a network service fGDB as network dataset It seems ...
0
votes
0answers
69 views

Using ArcPy.TableToExcel_conversion in Script Tool removes automatically added data

I'm using ArcGIS for Desktop 10.3.0.4322. I have a peculiar occurrence that I don't quite fully understand. I have a Python Script Tool that does a number of different things, to include using the ...
1
vote
1answer
58 views

Export data with data frame coordinate system using ArcPy

I want to export data in current data frame and use the same coordiante system as data frame using ArcPy as I have multiple files. Any suggestion on how to "Export with data frame's coordinate ...
1
vote
1answer
63 views

ArcGIS 10.2: ArcPy - how to replace workspace paths?

I am teaching myself ArcPy and I am attempting to make a code to replace paths to the items in my workspace. I had a file geodatabase and its path changed so I would like to automatically modify the ...
1
vote
1answer
62 views

Listing Data sources using arcpy: ListLayers very slow

What I am trying to do is create a list of all the data sources in a directory filled with mxds. So I have this code pasted below. For some reason when listing layers it can take up to 50 minutes even ...
1
vote
1answer
105 views

Value Error with Float/Integer/double Fields in Python?

When running this Code: import arcpy from arcpy import env import os #Specify the map document and the data frame mxd = arcpy.mapping.MapDocument(r"G:\\PythonCode\\mxd_test.mxd") env.workspace = ...
0
votes
0answers
45 views

Feature Services & arcpy.ConsolidateMap_management & .replaceDataSource

We have several in house published feature services, including some from our Esri Data Stores. When I use arcpy.ConsolidateMap_management on an mxd (10.1) the Feature Services are nicely consolidated ...
1
vote
0answers
93 views

Update Data Driven Pages Index layer via Python

I am trying to find a way to update the index layer for data driven pages through arcpy. I understand that to access DDP from arcpy.mapping you need to be referencing a MXD that has DDP enabled. My ...
0
votes
1answer
53 views

How to call the Manage Map Cache Tiles tool hosted by default in the system folder of arcgis server. I am getting ERROR 001428

When I am trying to call the GP tool Manage map service cache tiles that is hosted on the arcgis server by default in the system folder, I am geeting the followning error: ERROR 001428 Failed to ...
1
vote
0answers
66 views

Automating creation of ServiceDefinition from Python toolbox of ArcPy without broken project data source?

Summary: I can create a ServiceDefinition through ArcCatalog or ArcMap, but when I try to generate the ServiceDefinition through python, it does not copy the /data folder with it, thus the script ...
0
votes
1answer
28 views

Set polygon boarders to transparent in python

I am creating automated maps in ArcGIS with a similair Python Code which can be found here: Map automation to iterate through attribute table using ArcPy? I cannot find out on how to set the ...
-2
votes
1answer
42 views

Python Graduated Symbols [closed]

I am currently struggling with creating graduated symbols via Python. Based on ArcGISHelp 10.1 - GraduatedSymbolsSymbology (arcpy.mapping) I am doing as follows: import arcpy mxd = ...
0
votes
1answer
31 views

How to Print the Labels of a Unique Value Classification Using ArcPy? 10.2

I have a layer where I have symbolized the features on unique values. I have also grouped several features together. EX) Layer: Land Use; Value Field: Type of Land Use; Unique Values of different park ...
1
vote
1answer
40 views

Find and Replace shapefile source script not working

I'm very new to python so please forgive me if this is a simple error. I have quite a few MXD's in which each have a few layers referencing the same source. However I have since moved this data to a ...
0
votes
2answers
114 views

Python Crashes when Running ArcPy's ExportToPDF(), ExportToPNG(), ExportToJPEG()

I am attempting to loop through a folder of ~400 .mxd's and save each to a .pdf in another folder. All tested arcpy.mapping export functions (pdf, jpeg & png) kill python without a chance to ...
1
vote
1answer
67 views

Debugging/logging ArcPy / Python code behind ArcMap function?

Considering I Can use the right click --> set datasource at an mxd file to change the datasource. The following pictures describes how this can be done in arcmap.. How can I see the arcpy / python ...
0
votes
1answer
60 views

Using arcpy.mapping.ListLayers() with no filter, but some layers are missing in list

I am trying to use arcpy.mapping.ListLayers() to access and change some of the properties on specific layers in my mxd prior to printing to PDF. Here is a screen cap of my layer list: When ...
0
votes
1answer
43 views

Problems with ApplySymbologyFromLayer

I'd like to use specific colors for my Unique Values. I tried creating another layer. choosing the colors that I want, and using the ApplySymbologyFromLayer. I also updated my new layer to make sure ...
0
votes
1answer
36 views

is it possible to export map as png without having the webmap JSON?

I want to export the image of a map from a page that I don't have a map available. In other words I need to call a service where I will provide the definition expression of a feature layer, retrieve ...
0
votes
1answer
53 views

Create Several Feature Layers and add them to a MXD

Every time I run this script now, I get an error on the line with the MakeFeatureLayer line. Sorry for all the questions! I'm really new to Python. import arcpy, os arcpy.env.workspace = ...
0
votes
1answer
115 views

ArcPy Script to update LYR data source not identifying all layers in folder

I've put together a script that for the most part works as intended - to walk through a series of folders, find SDE layer files and update their data source to direct connects if the layers support ...
0
votes
2answers
54 views

SaveToLayerFile failed - “value is not a layer”

Tried doing a SaveToLayerFile on a layer in a workspace, but it confusingly says it's not a layer. I know it is a layer because the script can access lyr properties (e.g. name) and all of the ...
1
vote
2answers
191 views

Using Python to export multiple layers to .pdfs

I have found a solution to the issue below. The problem had to do with coding GetParameterAsText without actually using it as an input in a tool. That was the reason the raster layers wouldn't turn ...
0
votes
0answers
60 views

Object: Createobject Layer Invalid Data Source

I'm using a tool made for ArcGIS, however I keep getting this error (see picture). I do not know any python code and I'm trying to get this script to run. # Import system modules import sys, ...
0
votes
1answer
40 views

Create KML from MXD that contains map service layers like feature layers

How can I create a KML (tools suggestion), provided that I have a map (.mxd) file which layers are service layers of hosted services and not local data coming from a geodatabase. I know that the map ...
0
votes
0answers
23 views

Retrieve locally the data of an mxd that are contained in sevice layers and recreate a new mxd with static data (not coming from service)

I want to get/dowload the data contained in a map service and recreate a new mxd file with static (not retrieved from a service) data. I am interested for data coming from feature and graphic layers. ...
0
votes
1answer
44 views

Arcpy:Set min height for contour area, with surrounding contour lines

I'm trying to create a tool that will calculate the min depth and the max depth of a contour polygon, based on the value of the depth attributes of the surrounding contour lines. This is what I have ...
1
vote
1answer
185 views

Looping through Layers, Add Layer to MXD, Export Image, Repeat, using ArcPy?

ArcGIS 10.2.2 I am trying to loop through a list of layers in a folder, add each layer to an mxd and export an image of the added layer. I have added arcpy.mapping.RemoveLayer to the script to remove ...
0
votes
2answers
53 views

Missing labels when using arcpy.mapping.ExportToPDF

I have a script that is run on a daily basis to export a folder of MXDs to PDFs and I have noticed some peculiar behavior. Many, but not all of the PDFs will be missing some labels or their label ...
0
votes
1answer
66 views

Map automation. Mapping same feature class – a map per data field (graduated symbols, customizable break values)

Map automation. Mapping the same feature class – a map per each data field (graduated symbols, customizable break values). I am trying to automate a mapping effort: I am mapping a (FC) features ...
3
votes
1answer
112 views

how to copy layer and add to same mxd and rename layer using ArcPy and ArcMap 10.2?

I am trying to copy a layer in an mxd and add that layer to the bottom of the TOC using Python, but I have not found a way to save the mxd programatically without making a copy. I also haven't found ...
0
votes
1answer
149 views

Get Path of File found with os.walk [closed]

I am trying to expose the full path of a file found using os.walk. The walk function is working correctly and is exposing all the files I want however when I try to get the path it looks like it is ...
0
votes
0answers
28 views

Exporting multiple map pages from list of apns

I use the code below to export two maps with different layers active for a single apn. The problem is I have a large list of APNs to go through so plugging in each apn at a time isn't really feasible. ...
0
votes
0answers
55 views

Symbology templates mess up colors and legend labels when used in Python script

I'm having issues when trying to symbolize a layer from a .lyr template using a python script. The templates work when imported in ArcMap as seen below: But when run with the following Python ...
1
vote
1answer
95 views

Error using arcpy.da.SearchCursor and MakeFeatureLayer

im trying to write a script that allows me to iterate through my map layers, and for each layer, iterate over each feature and add a field that gives the location of the feature using my index layer ...
1
vote
3answers
186 views

Programmatically adding .shp file to .mxd file

I have spent hours attempting to find the solution to the following problem online, but all answers I have found are quite old, and none work. Here is the situation: I have a variety of .shp files. I ...
1
vote
1answer
66 views

ApplySymbologyFromLayer works in ArcMap but not in python script

So the ApplySymbologyFromLayer_management() tool doesn't seem to like me, at least when I try to use it in a script. I have a Field_Boundary2.lyr file that has a "hollow" fill color and a black ...
0
votes
0answers
122 views

Output extent environment is not respected by Select Layer By Attribute (ArcGIS 10.2)

I cannot get the arcpy.env.extent working for Select Layer By Attribute GP tool. I can verify that I get various values for coordinates when I have panned to various areas on the map. Copy Features GP ...
0
votes
0answers
52 views

Training course for Fixing Data Sources

Is there any good training course or literature that pays some attention to automated processes for fixing map documents' data sources? Esri's little documentation on it is not helpful enough for me.
0
votes
1answer
212 views

ValueError: Layer: Unexpected error from replaceDataSource()?

I'm trying to write a script that allows me to look through map documents and replace each layer's data source in each map document. Everything is working logically I believe, and all my loops are ...
0
votes
1answer
67 views

Layer still in map after running arcpy.mapping.RemoveLayer?

I'm trying to run a script that removes a group layer from a set of map documents, the code runs and the correct zone to be deleted prints out, However, when I check my map documents, the layer is ...