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

learn more… | top users | synonyms (1)

0
votes
1answer
28 views

sum of raster counts

I'm trying to get the sum of "counts" in a raster. I have the code below which can successfully read the counts of each row in raster attribute and stores the counts in a list provided below. ...
1
vote
2answers
41 views

Formatting label expression with newline using Python parser? [duplicate]

I'm having trouble with syntax in 10.2.1, and have have tried just about everything. With arcpy, I am attempting to access a label.expression of an ArcMap layer and modify it to: lbl.expression = ...
1
vote
1answer
102 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
28 views

How to use arcpy to ungroup a group layer in an mxd

I am looking for a way to ungroup a group layer using arcpy... (instead of having to open the mxd and right-click on the layer to choose "Ungroup"...) mxd = arcpy.mapping.MapDocument(pathToMyMxd) df ...
0
votes
0answers
23 views

Using arcpy to enable layer masking (Advanced Drawing Options)

I am looking for a way to enable and change layer masking (under Advanced Drawing Options) with arcpy... it seems you can do this if you have the Production Mapping extension, but I do not have it... ...
1
vote
1answer
37 views

Can i use CreateMapSDDraft in the arcpy.mapping library to set the scale range on tiled services at 10.1?

I know that esri has exposed many properties to the acrpy lib for publishing services. I need to published a tiled/cached map service but i need to set the min/max scale when i do that. Can this be ...
0
votes
1answer
35 views

IOError trying to change PICTURE_ELEMENT sourceImage

I recently ran into this issue after I published a Geoprocessing Task to a production server. It appears to be the same problem discussed in this question, but there is no answer posted there yet. ...
1
vote
1answer
204 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 ...
2
votes
1answer
45 views

Flagging when point feature(s) covered by tables (made as graphics) using ArcPy?

I've set up data driven pages to create a series of maps, but I'm running into a problem which seems like it would be quite common! I've made some tables (as graphics) using ArcPy and the technique ...
0
votes
1answer
45 views

Iterative interpolation

I have an excel file with about data from 600 locations, each location having data for 1200 months(12 months* 100 years). I need to interpolate all point locations into rasters for each month of each ...
4
votes
1answer
221 views

How to add Table to Layout View using ArcPy?

I am using ArcGIS 10.1 and I have a non-spatial table and some layers in a Data Frame. When I switch to Layout View I want to be able to show the map in a data frame element and the table in another ...
2
votes
1answer
177 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
385 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 ...
2
votes
1answer
468 views

How to add new data frame(s) to map using ArcPy?

I want to add a 2nd data frame to an existing "*.mxd" file. Right now, i see option to add layers and edit properties of "CURRENT" data frame but could not figure out how to add a new one and export ...
1
vote
1answer
59 views

Error with data frame in python script

I'm running a python script from arccatalog and it works, however, I am trying to add layers to an mxd and need to declare the data frame. I keep getting this error message. type ...
2
votes
3answers
1k 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
62 views

Optimize PDF using Python [closed]

Is there a way to optimize a PDF using Python? I am exporting hundreds of .mxds - that works fine with a loop. But the file size of each is large. Right now my option is to manually open each and ...
0
votes
1answer
45 views

replace data source for all layers that point to shapefile

Hi I'm trying to do something quite simple but its not working. I want my python script to change all of the layers that point to the same datasource (a point shapefile) to another point shapefile. ...
1
vote
2answers
403 views

Create an X,Y latitude and longitude grid from an raster

I have a satellite image (LandSat 5), I want create a raster with X,Y coordinates, this is possible in Model Builder of ArcGis 10.0? or other option. I know that the option $$YMAP ($$XMAP) not work ...
2
votes
2answers
321 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): ...
1
vote
3answers
132 views

Assigning UNC Path to arcpy.env.workspace

For some reason my python script crashes ever time it reaches the following code which attempts to assign a unc path as my workspace. Can any of you please help me solve this problem? Also, I'm not ...
0
votes
1answer
65 views

AddLayer method failing when script in ArcToolbox is run from ArcCatalog

I need a 2nd set of eyes to do a sanity check, as I am not been able to figure out why a script that runs fine in pywin, does not run properly as a tool in a toolbox. Below is the script that runs in ...
0
votes
1answer
44 views

How to restrict read only *.mxd file?

I have an *.mxd file and I don't want to save any edits to it after each session. Is there a way in 'arcpy' or python in general to restrict edit of *.mxd file? Any suggestions would be appreciative.
2
votes
2answers
76 views

how to solve UnicodeDecodeError in arcpy?

I need to update datasource of Picture element of laout element of a mapdocument. but it is showing Unicode decode error. mxd= arcpy.mapping.MapDocument("CURRENT") for elm in ...
3
votes
1answer
55 views

Automaticallly select and replace all occurences of a font face

I have around 50 mxd file that is done some times earlier. The text font used in labeling was not licensed. Now I can Change the text in layout element. But it has also some text in map view too. But ...
2
votes
1answer
155 views

How to generate dynamic legend using ArcPy?

I used this example to produce printing service. As the result I get map with too many elements in the legend. Is it possible ti show classes that are visible in the current map extent using python ...
0
votes
0answers
64 views

arcpy.mapping.Export creates some labels but not others

I've created a simple python toolbox (pyt) to export map layouts to multiple formats. My problem is that some labels which are defined in the layout are exported, but others are not. For example ...
1
vote
1answer
48 views

How to get replaceDataSource to work with personal geodatabase?

I am having trouble using the arcpy.mapping's replaceDataSource with a personal geodatabase. The script runs, but does nothing if I run the script in the python window of ArcMap. If I run it in ...
1
vote
0answers
522 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
2answers
147 views

How to export a MXD to a PDF but only switching the folder

Let say I have two variables. InputMXD = parameters[0].valueAsText PDF_Folder = parameters[1].valueAsText I have my inputMXDs to have multivalues so I'll have around 10 mxds each time the ...
0
votes
1answer
70 views

I can't seem to use arcpy.mapping print command. It's not displaying the mxds in the loop

Here's the code for the third parameter that list the local printers: # Third Parameter printer = arcpy.Parameter( displayName="Select a Printer", name="printer", datatype="String", ...
0
votes
1answer
72 views

Listing Printer names in a Python Toolbox in Arcgis 10.1?

Here's my code for my third parameter in my Python Toolbox. When I run the toolbox and look at the list of printers, it only shows one of them. My print command of 'printerName' lists all of them in ...
0
votes
1answer
59 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 ...
1
vote
1answer
102 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
121 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
138 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
132 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 ...
3
votes
2answers
185 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 = ...
1
vote
1answer
65 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
112 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
242 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 = ...
3
votes
1answer
871 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 ...
2
votes
1answer
68 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 ...
1
vote
0answers
56 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
301 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
423 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 ...
3
votes
0answers
65 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
100 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
136 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 ...