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

learn more… | top users | synonyms (1)

0
votes
0answers
24 views

Meaning of AttributeError: 'module' object has no attribute 'da'? [duplicate]

error is : AttributeError: 'module' object has no attribute 'da' Code is below: import arcpy import os from arcpy import env # Set local variables inWorkspace = "Q:\\NHD project\\Connection ...
2
votes
1answer
42 views

How do I import an ASCII grid using arcpy?

I'm trying to automate the setup of some flood depth/hazard maps. The user specifies a folder containing depth grids generated by a hydraulic model (.asc format) and some background mapping (geotiff ...
2
votes
1answer
44 views

MakeFeatureLayer weird behavior from script

I am trying to add a feature layer to my map document as the output from my python script. The goal is to limit the number of fields in the attribute table to a pre-defined list. I am able to add ...
0
votes
1answer
20 views

Assertion Error, Trying to add .tif to group layer

So I am trying to add a layer to a group, but running into problems most likely because of the file is a .tif. I have tried quite a few different iterations of this and looked at a few solutions but ...
1
vote
1answer
36 views

findAndReplaceWorkspacePaths does not work for sde files so as to change datasouce (geodatabase)

I manage to change my datasouce by right clicking on an mxd file and choosing a different sde database connection file as shown in the following image. However When I try to do this using arcpy ...
0
votes
1answer
22 views

Problem in adding raster layer from arcpy

I am using the following code to add the raster layer using arcpy in arcmap def AddRasterLayer(path,layerName): layer=os.path.join(path,'new'+str(layerName)+'.lyr') ...
1
vote
1answer
95 views

ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Layer Name or Table View: Dataset L does not exist

Hi I am trying to create a loop so that each layer is produced in its own map. This is my code: import arcpy path = "C:\Users\Et\Documents\ArcGIS\Default.gdb" mxd=arcpy.mapping.MapDocument(path ...
2
votes
0answers
32 views

A list of layer names that you want to be turned off when Layers name are in Right to Left Such as persian

When I ran this code I got "UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal" error I don't know why I tried many way but I ...
0
votes
0answers
30 views

Labels aren't displayed for layers inside a group

I'm using a python script to create an empty group layer in the current map document, add some layers to this group and update their symbology from an existing .lyr file. I also want to to turn on ...
2
votes
0answers
48 views

Validating whether PDF file Uploaded as part of Geoprocessing Service of ArcGIS for Server?

I'm developing a Python Script that will be a Geoprocessing Service in ArcGIS Server. The Script has a Button for Users to OPTIONALLY Upload a PDF. If the PDF is Uploaded it gets inserted into the ...
2
votes
1answer
30 views

Is there a a way to add a topology dataset to an mxd with arcpy?

I have a script that identifies certain layers from a folder containing several geodatabases. Part of the scripts purposes, or intended purpose is to have it add a topology dataset to the dataframe. ...
2
votes
1answer
64 views

Exporting layout elements and constants to Python script?

Is it possible to export the elements and constants used in a layout to a Python script? Something similar to creating a model and exporting it to Python but instead of being a model, it's a layout? ...
1
vote
0answers
44 views

How use DataFrame Geographic Transformation User Interface with ArcObjects?

I am bringing data from SQL Server into ArcMap with ArcObjects as a Query Layer. If I do this manually, a 'Geographic Coordinate System Transformations' UI pops up. I would like the same thing to ...
1
vote
1answer
56 views

Add annotation feature class to mxd with arcpy

From what I have researched, I'm pretty sure the answer is NO, but I want to make sure no one has found a work-around. Annotation feature classes in personal geodatabases need to be added to mxds. ...
1
vote
1answer
111 views

Conditional drop-down menu list in a python script tool

I have created a script tool from some python code, and in a previous question, I learned how to enable a drop-down list in this tool by changing the Validation code - see link and image below: ...
2
votes
1answer
66 views

Is it possible to create a data frame graphic using arcpy?

I'm interacting with an MXD using arcpy, and wish to create a graphic within a data frame - as with the Draw toolbar when working manually. The GraphicElement page says... The GraphicElement ...
2
votes
1answer
67 views

How do I rename rasters in an mxd by using my csv?

I have the following data in a csv: RasterName First name Raster 1 Aaron Raster 1 Paul Raster 2 Bryan Raster 3 Cranston Raster 3 Vince I have added these ...
1
vote
1answer
47 views

Clip layers in a dataframe with a polygon in python?

I'm trying to clip layers in a dataframe with a polygon using python and I've done this python script but it's giving this error:"ERROR 000840: The value is not a Feature Layer" Thanks for any help. ...
1
vote
0answers
306 views

Copy Features giving ERROR 000210: Cannot create output in ArcPy?

I have an issue where I'm trying to save separate feature classes for each route in an already solved closest facility problem, and one seemingly arbitrary route won't save. I tried to look at the ...
1
vote
0answers
66 views

Script tool: Batch downgrade MXD version

I am trying to take the guts of this code (Batch convert ArcGIS 9x files to 10) and build it into a tool that we can more flexibly use and share around our organization. I think I'm almost there but ...
1
vote
0answers
31 views

Speeding up arcpy's TextElement.delete()

I'm making tables to go on data driven pages. For each page there are a series of tables that are produced. The elements of the tables are made using the clone method. The problem is that it takes ...
3
votes
0answers
14 views

List Joined tables

I've a question about arcpy List* modules. I have a quite large amount of data on SDE Server. Earlier I made a list of the feature classes , and tables in the mxd-s placed there using da.Walk and ...
1
vote
2answers
25 views

Matching feature classes by similar name for map automation

I was working on this a bit ago and had something which I thought worked however, it does not seem to be working at the moment. What I'm trying to do is match feature classes having similar files. One ...
2
votes
1answer
50 views

Batch create maps using arcpy.mapping

I'm trying to create .mxd and PDF outputs for a series of feature classes in an SDE. I'll need to match 2 feature classes (one original, one buffered) in the SDE based on similar file names. The ...
1
vote
0answers
30 views

Problem with adding mosaic layer via arcpy

I have a mosaic layer that I want to add to my map in ArcMap. When I add this layer manually (i.e the "Add Data" button), a raster image, a boundary, and a footprint are added to my table of contents. ...
1
vote
1answer
28 views

Creating map documents based on similar feature class selection

I wondering if something like this is possible. I would like to create a PDF output using a pre-established map template. The tricky part is I want to create maps in batch by adding (what will usually ...
1
vote
1answer
42 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
306 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 = ...
2
votes
1answer
89 views

Using ArcPy to ungroup group layer in 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
45 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... ...
0
votes
1answer
65 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. ...
2
votes
1answer
48 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
72 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 ...
1
vote
1answer
111 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
1answer
101 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 ...
1
vote
1answer
98 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
99 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
825 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 ...
0
votes
1answer
91 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
48 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
146 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 ...
2
votes
2answers
384 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 ...
3
votes
1answer
60 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 ...
0
votes
0answers
86 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
72 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 ...
0
votes
1answer
123 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", ...
4
votes
1answer
545 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 ...
0
votes
2answers
315 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
92 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 ...
1
vote
3answers
291 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 ...