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

learn more… | top users | synonyms (1)

1
vote
0answers
1k views

How to use replaceDataSource to replace data source for multiple layers?

I appear to be having difficulty with using 'replaceDataSource'. ESRI has atrocious documentation on updating and fixing data sources, and almost everything I have read on the subject is almost what I ...
0
votes
1answer
188 views

How to zoom to selection in arcpy.mapping and only see selected features?

I selected data by using select layer by attribute, then I need to only select these selection and zoom in to the selection. my code is this, it can zoom in base on the scale I set, but I see other ...
0
votes
1answer
183 views

Is it possible to get full path for broken data source to repair broken data link?

This question links back to an old question of mine: Convert shapefiles in nested folder to geodatabase I am attempting to find a permanent solution to fixing the broken maps, and in such a way that ...
1
vote
0answers
189 views

Why is arcpy.mapping.ConvertWebMapToMapDocument slow?

We use arcpy.mapping for print tasks. The slowest part in workflow is arcpy.mapping function ConvertWebMapToMapDocument; it takes 10-12 seconds each time, doesn't matter if map is big or not. We use ...
0
votes
1answer
191 views

How do I edit a Direct Connection Workspace using arcpy.da.Editor?

How to start editor to edit version data for ArcGIS 10.1 direct connection. I tried as given below code but it is throwing an error "Operation only allowed by the owner of the version [SDE.DEFAULT]". ...
1
vote
1answer
77 views

consecutive generate Sql query using script arcpy

I am using arcgis 10.1 I am currently doing a lot of sql query feature class and I am thinking of automating this process so far my escrip is as follows import arcpy ...
1
vote
1answer
146 views

How to validate whether shapefile exists using ArcPy and Python function?

I am very new to Python and am trying to complete my final project with not a lot of success. My code works without functions, the problem is I need it to work with functions. In the main(): ...
0
votes
2answers
412 views

How to List Tables from current map document (mxd)?

We have many maps containing Feature Classes and Tables in a Personal Geodatabase that need their information updated. Is there a function to List Tables from the current map document like mxd = ...
2
votes
1answer
99 views

Why is arcpy.mapping.ExportToPDF losing layer symbology?

When exporting a map it does not export the symbology within the data frame. I am using the code snippet below. >>> myMap = arcpy.mapping.MapDocument("C:/USERS/NISUSER/DESKTOP/mxd_map.mxd") ...
1
vote
0answers
21 views

Fix broken SDE layers with Arcpy - unexpected error [duplicate]

We are in the middle of our ArcGIS 9.3 to 10.1 migration project and we have a lot of custom map documents (from different users) that among others, point to our current 9.3 SDE database. After our ...
3
votes
2answers
293 views

How to change the style of the north arrow from “ESRI North 4” to “ESRI North 1”?

I have a Python assignment where I have to write a script to change the style of the north arrow from “ESRI North 4” to “ESRI North 1”. I wrote the following code: import arcpy mxd = ...
3
votes
1answer
576 views

layer.visible command not working in arcpy.mapping module

I am using the arcpy.mapping module for the first time, and the lyr.visible command is not working as it should (or I am not using it as I should). I have a list that contains the the layer names of ...
4
votes
1answer
803 views

Managing symbology in Feature Classes

I'm using an enterprise db to store my data and I'm writing a python tool that allows me to interact with that data in ArcMap. However, all my layers someone have "OTHER" for the symbologyType (not ...
1
vote
1answer
74 views

Weird Error when setting the source path in the “PICTURE_ELEMENT”

I am trying to set the sourceImage to a tiff file using this code: m=1 pic = arcpy.mapping.ListLayoutElements(mxd,"PICTURE_ELEMENT" , str(m))[0] pic.sourceImage = ...
2
votes
1answer
241 views

Export data driven pages only in changed mxd, with arcpy script

I have an arcpy script below to export a map book to pdf. The index layer are forty acre boundaries (township and range quarter sections). The data in the mxd is on an oracle database and updated ...
3
votes
3answers
621 views

Additional Parameters for PrintTask?

Hi Guys I'm writing a custom GP tool for printing with 10.1. I need to pass some additional parameters into GP tool. I'm using printTask from jsapi and I couldn't add more parameters just by adding to ...
3
votes
0answers
73 views

Is it possible to access individual pages within an existing pdf using arcpy.mapping?

I've used the arcpy.mapping module for some time now to create mapbooks and other pdf documents, using a combination of Data Driven Pages and Python. I would like to take an existing pdf and save each ...
1
vote
1answer
118 views

Export some specific pages from data driven pages to pdf file by python

I need to export pages 14, 13, 23 and 24 of 26 pages of data driven pages to pdf file by python and then add the pdf file to the final pdf file by arcpy (python), any help please?
1
vote
1answer
189 views

ARCGIS10: updatelayer results in error - LayerObject: Get attribute renderer does not exist

I'm quite new in using python in Arcgis 10. I wanted to use the symbology of a geostatistical layer in the TOC in another geostatistical layer in the TOC. Therefore, one should use ...
1
vote
0answers
66 views

Convert List by Source to List by drawing order using arcpy

When I do some calculations, it results in adding a table to TOC which converts "List by drawing order" to "List by Source". I want to convert it back to "List by drawing order" using arcpy and I am ...
0
votes
2answers
158 views

Unable to execute ArcPy module outside of ArcGIS environment

I am using ArcGIS for Desktop 10.1 (Arc Info license) and ArcGIS for Server 10.1 and automating few things on server level and getting interesting errors. I am overwriting map service through this ...
1
vote
1answer
983 views

How to use CURRENT map document in Python tool?

I am attempting to use this code in a tool that I am working on: mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] XMIN = df.extent.XMin YMIN = df.extent.YMin XMAX ...
0
votes
1answer
190 views

Using Unique Values Symbology in ArcPy?

I am using ArcGIS for Desktop 10.1 and Server 10.1 on my machine Windows 7. I am newbie in python & running simple python script for UniqueValuesSymbology it running fine if I use mxd as ...
0
votes
1answer
802 views

Overwrite existing map service in ArcGIS Server 10.1 (through ArcPy)

I am using ArcGIS DT and Server 10.1. I want to over write existing map service though ArcPy and going through this link and getting an errorRuntime error Traceback (most recent call last): File ...
1
vote
1answer
244 views

Can ArcPy collapse layer in current data frame?

Online ArcGIS resource help provides a list of layer properties which can be used as needed. I am not able to find a way to collapse a layer using ArcPy in it. Please suggest if there is a way to ...
3
votes
1answer
1k views

How to save currently opened mxd and changes using ArcPy and Python?

Here is what I have so far... import arcpy import arcpy.mapping as map mxd = map.MapDocument() mxd.save() And yes I know that map.MapDocument requires an argument, but I want it to automatically ...
1
vote
1answer
115 views

How to Average neighboring county data and store in original?

I have data for several rain stations, i have averaged the data and given each county a value. Some counties have null values and I would like to pull the data from the all the bordering counties and ...
1
vote
1answer
591 views

arcpy.mapping Graduated Colors Symbology

I'm trying to figure out how to apply graduated color symbology to a feature class by using arcpy.mapping in ArcMap 10.1. To start, a script runs and a feature class is added to a map document, no ...
2
votes
0answers
50 views

Difficulty in running the script

I have developed a script tool for adding a layer in the current map document. It did not work.. The message is "Completed script addlayer...". But there were no layers added in the TOC. Another issue ...
1
vote
1answer
146 views

How to query and display layer using ArcGIS Python script tool? [closed]

I have database which contains point shapefiles and raster files for 3 species. My aim is to develop a script tool that should have a search tab to enter the species name. also, a check box to select ...
1
vote
0answers
216 views

arcpy ArcGIS Server

Could someone please help me by giving me an example on how to make/connect/Add ArcGIS Server connection via python/arcpy? Thank you in advance. I'm using ArcMap 10.0 I desire to "Use GIS Services" ...
2
votes
2answers
453 views

Using arcpy.Describe Method on Annotation layers

I'm testing layers in the current document using the Describe function. My code is: for lyr in arcpy.mapping.ListLayers(df): if(lyr.isGroupLayer == False and lyr.isRasterLayer == False): ...
2
votes
0answers
234 views

Can not get text element to update?

I can not get text element to update? Text ELement has been added "Subdivision" Still not updating?.. class ButtonClass2(object): """Implementation for FemaMapper_addin.button (Button)""" def ...
1
vote
1answer
371 views

Data Driven Pages, Graphs, and selections in ArcMap 10.1

Is it possible in python to create a selection set based on the extent from a Data Driven Page (DDP)? I have a layout view with a map and a graph. The graph is set to only plot the selected set of ...
0
votes
1answer
360 views

How to update element text in arcpy.mapping? [closed]

I have a problem updating a map element text (named element1) in a map document using the following code: a1 = '"' + ("element" + str(1)) + '"' for elm in arcpy.mapping.ListLayoutElements(mxd, ...
1
vote
1answer
264 views

Add raster catalog to MXD using arcpy.mapping

Using the bit of code below adds the raster catalog footprint polygon layer. mxd = arcpy.mapping.MapDocument("Current") df = arcpy.mapping.ListDataFrames(mxd, "*")[0] addOrtho2011 = ...
3
votes
1answer
165 views

definition query and mosaic dataset from gdb ArcMap 10.1 SP1

I have a Python AddIn Combobox to select a value from the drop-down list. This value changes the definition query of the layers in mxd. This works fine for "normal" feature classes, not for a mosaic ...
2
votes
1answer
574 views

How to use arcpy.mapping to batch export layer to KML?

I am trying to export map layers from an MXD to KML using arcpy with the following code: import arcpy, os, sys, traceback arcpy.env.overwriteOutput = True mxd = ...
0
votes
1answer
389 views

How to add a graphic table element in Python without Production Mapping extension?

I'd like to add a table in the Map Layout that includes only items visible at the current extent of the dataset. I know that the Production Mapping Extension lets you insert a Graphic Table Element ...
3
votes
4answers
554 views

Create a Menu Containing a List of Layers That Can be Added to an MXD Using arcpy.mapping

Is it possible to create a list of layers (residing in something like a menu) that can be selected and added to an mxd using arcpy.mapping. I've been using the bit of code below (there's someone I ...
0
votes
1answer
166 views

How to code Data Driven Process using ArcPy?

I need to come up with a Python code to automate a map creation process but I am a little bit of lack of python knowledge. Any help would be much appreciated. My problem is that I have a 20 mxd file ...
3
votes
0answers
109 views

Why aren't a layer's serviceProperties exposed if the data source is broken? [closed]

In ArcObjects you can get the service properties of a map layer by looking at its IWorkspaceName.ConnectionProperties property set, even if the layer is currently invalid due to a broken connection. ...
2
votes
1answer
128 views

Add table from SDE to ArcMap TOC via ArcMap python window

I would like to add a specific table or shape file to my TOC via the ArcMap python window from the SDE connection I'm currently connected to. Since I'm already connected to the SDE connection in ...
2
votes
3answers
2k views

pop up message box before a tool execution with arcpy/python

I want to add a box message to pop up before execution of a button tool. When I click a button which will do geoprocessing, i want a box to appear on view before processing with message that i am ...
2
votes
1answer
66 views

create folder with random number for each session using arcpy

I am processing data and it is required to have same name of outputs [standard names] for different geographical regions. Therefore it is necessary to save outputs in different folders each time. Is ...
5
votes
1answer
1k views

How to update shapefile data source in multiple dataframes and mxds using lyr.replaceDataSource and Python dictionary?

After reorganizing the file structure for some of our GIS base data files I need a script to update the data sources for ~ 100 shapefiles in about 50 mxd files. Some of the mxds have multiple data ...
1
vote
1answer
240 views

Removing/adding values in symbology window with arcpy

I'm using arcmap 10.1 and have one shp with many polygons with different typeID. I want to make a serie of maps showing each typeID on an individual map. Since I have many typeIDs I want to use arcpy. ...
4
votes
1answer
1k views

Problem getting the arcpy mapping module to export a layout view map

I'm using the arcpy mapping module to create a series of images and am having trouble exporting a map document to PNG in layout view; I can only get the script to export the data frame view. I've seen ...
2
votes
2answers
2k views

ExportToJPEG() arcpy script failure

I'm attempting to writing a python script that will automate exporting a set of stock maps to JPEG from their mxd files, and I'm having some strange issues getting there. I've alternatively been ...
2
votes
1answer
1k views

ArcPy: Using lblclass expression to change font style and color

I´m trying to label features of a dataset using ArcPy and the lblclass function. While commands like "VBNewline" and "Round" work pretty well, I´m not able to change colors or font style. An ...