A site-package created by Esri to expose many ArcObjects to Python.

learn more… | top users | synonyms (1)

0
votes
1answer
76 views

How to add an image (jpg) to an existing layout using Python?

I have 1500 MXD whit the same template layout, and need insert other image for the al mxd thanks for your time. version arcgis 10.1
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 = ...
3
votes
1answer
145 views

Checking .mxd version using ArcPy?

I am looking for a way to check the mxd version of a bunch of mxds. I found a script here at ArcPy method to determine ArcMap document version I am using ArcGIS 10.3.1 on my desktop. It goes through ...
0
votes
0answers
52 views

ArcPy: execute code for each feature in a dataset

Is there a way in ArcPy to iterate through a dataset and do something with the current feature without having to manually select that feature? Two examples for clarification: - export each feature as ...
0
votes
0answers
30 views

How to sort points in a proper order using arcpy? [duplicate]

As the picture shown in below that i have bunch of points distributed in an area. The problem is that their attribute records of each points is not in a proper order as u can see in the left bottom ...
1
vote
1answer
63 views

Adding feature class into ArcGIS 10.3 mxd using python script [duplicate]

I am trying this simple task to add a feature class to an mxd (ArcGIS 10.3) but getting few errors. Here are two options I tried. 1) Preferred option - adding feature class itself into a active ...
0
votes
1answer
220 views

Arcpy: MakeFeatureLayer_management: Where is the file?

I am trying to understand arcpy/python, and am confused about where a layer file is located during the process. This is my code: import os, sys import arcpy gdb = "C:\\Example.gdb" featureClass = ...
1
vote
1answer
134 views

Scripting spatial join in arcpy - how to set field attribute in field mapping object?

I'm scripting a spatial join in ArcGIS with Python. I only want the resultant feature class to have a single field containing one attribute from the join features. In general, many join features ...
1
vote
4answers
77 views

ArcGIS 10.2.1 arcpy handling quote mark styles

I have been asked a question that I believe is due to a mix a quote marks however I cannot specifically say why this is so in the example below. I wondered if anyone has had a similar issue. A small ...
0
votes
1answer
48 views

ArcMap 'in_memory' trouble?

Being new to ArcMap, and ArcPy I have a problem with a script including several geoprocessing functions. The number of functions inspired a search for a means to save outputs (subsequent inputs) to ...
0
votes
1answer
71 views

Reversing polyline direction based on raster value using ArcPy?

I am trying to create an ArcPy script that will read a raster cell value at the start point and end point of a polyline, and flip the line based on those values. I do not want to create another ...
0
votes
1answer
62 views

Usage of 'in' in Python [closed]

Can someone please tell me whats happening here. I'm still new to Python for ArcGIS and I really need to understand this piece of code for my project. How does dct_max work and how is tpl created? At ...
1
vote
2answers
68 views

Spatial Join - One Join Feature to Multiple Target Features

I want to join a set of target features (polygons) to a set of join features (points). The polygons can, and do, overlap. I want the join features to be counted (joined) to as many target features ...
1
vote
0answers
46 views

Portal for ArcGIS WMTS layers are optimised & un-cacheable

When a WMTS in Portal for ArcGIS 10.3.1 is opened (via Portal) in an mxd, the WMTS layer properties are not standard. The; Source, Layers, and Advanced tabs are missing. When the portal WMTS layer ...
1
vote
2answers
73 views

Access individual bands and use them in map algebra

I have a list of multiband rasters, consisting of: Red=Band 1, NIR=Band 2, SWIR1=Band 3 and SWIR2= Band 4. What I want is to access only the red and NIR bands and save it to new file. Then, I'll be ...
1
vote
1answer
75 views

Reference Selection in SQL query (where clause)

I keep raising errors with my where_clause in the 9th line of this script. FID is an Object ID field and I want the cursor to select whatever row it is currently pointing at. I don't know how to do ...
1
vote
1answer
60 views

CalculateField with variables

I'm trying to make a python script on arcmap 10.2.2 which will copy values from an old field (selected by the user) and paste them in an new field (named by the user). I wrote that: fc = ...
1
vote
2answers
56 views

Error when creating data with special characters and numbers [duplicate]

My code will not project and store the feature layer in the scratch.gdb. "ERROR 999999 ... The table name is invalid. The table was not found. [17_5330_51961Lake]" The interpreter doesn't like "-" ...
0
votes
2answers
26 views

Easy Data Source Removal

I am trying to remove anything in a map that has "DI" in the source path. I have a test mxd with one df and 2 lyr's. The lyr data sources are: ...
1
vote
1answer
39 views

Does arcpy have any tools for transforming field values in a fieldmapping?

I built my fieldmappings and, for the most part, everything is working. I recall reading somewhere that I could also use fieldmappings to transform field values during the import process. ...
0
votes
1answer
36 views

ArcGIS GP Tool as sd file with multiple scripts

Is it possible to add multiple script files containing other python classes, config etc, and even .sde connection files when publishing service definition from arcmap? I do not have access to the ...
0
votes
1answer
42 views

Custom Script Tool - Raster Index

I am still somewhat raw with python, although I am learning and trying to develop some tools. What I do need help with is a script tool which creates an index of rasters. It was created by someone who ...
1
vote
1answer
46 views

When building fieldmappings, how do I handle the SHAPE field?

I have a collection of hundreds of shape files and a python dictionary mapping the input field to the output field. I'm building my fieldmappings dynamically using this dictionary since it already ...
2
votes
4answers
253 views

How to export tables to Excel from ArcGIS 10.1 using the xlsxwriter python module?

(I've edited this question to reflect some of the answers/insights from below...) Original(ish) Question: I'm wondering if someone can share a bit of insight (or actual code) on how exactly to export ...
0
votes
0answers
72 views

Arcpy strip '{ and ]' from list return

I have a static list that I would like to pull values from and use in a query. I can populate the list dynamically from the data but the set is quite large and I think having a static list from a csv ...
2
votes
2answers
107 views

Proper syntax for Select Feature Layer by Location

Can someone let me know how I can use a single feature from one layer as the "Select Features" when using the Make Feature Layer by Location tool with another layer as the input? In the code below ...
0
votes
1answer
61 views

Counting Features to Calculate Field Value

Generally, I am trying to find the # of features in one shapefile within 1000 feet of EACH feature in a second shapefile - and then populate a field in the first shapefile with that #. More ...
0
votes
2answers
84 views

Arc Python add in - dynamic combo populate

I am attempting my very first python add in. what I would like it to do is look at a feature class, look through the town field. when the user selects a town I want the next combo box to populate with ...
1
vote
2answers
77 views

Arcpy - Calculate total time, last value minus first value

For the script tool I've written (below), one of the things I want to do is after user input has pulled tabular data (into a feature class) I want to take the last value of the 'logdt' and subtract it ...
-1
votes
3answers
191 views

Unable to connect to “Database Connections/.sde” from python

I just upgraded to 10.3.1 and now I am having issues running my administrative tasks set with Python scripts. I am unable to use the string "Database Connections/some.sde", i.e: ...
1
vote
2answers
56 views

SQL query new feature with loop

I'm trying to create an individual buffer feature class for each column of an input feature class, where there is a field that contains the buffer distance. I think there is a problem with my SQL ...
0
votes
1answer
31 views

Python brkLyr.supports (“dataSource”) Error

This is supposed to loop through a directory of MXD's and look for broken links and create a report. I am getting an error, an exception I believe, on one of the data sources. In the MXD it shows a ...
1
vote
2answers
114 views

Create an array from field values in ArcPy

I have a feature class that has a field of unique ID numbers. I would like to create an array of these numbers so I can loop over them in ArcPy. Any ideas?
0
votes
1answer
73 views

Select by attributes with user input using Python

I am new to GIS and Python is not my forte, so I am looking for some help. Ideally, what I am trying to do is create a tool that allows the user to select an address from my Address points layer. I ...
1
vote
1answer
112 views

arcpy; Select by attribute with an If, then statement

I am looking for some advice on how to construct an if, then statement based on a select by attribute SQL query or some other method (search cursor?). I am asking users to input a unique ID ...
0
votes
1answer
15 views

How to retain domain descriptions from selected features in database to new database?

I have the following script that selects features from an enterprise database and then exports them to a new database. However, two columns in the database contain domains. How can I keep the ...
1
vote
0answers
74 views

Extracting color values from layer to build index using ArcPy/ArcMap?

My university wants the maps we create to become more standardized and so we're changing all the colors on our base vector map. The new standard needs to be indexed and I have the task of creating ...
0
votes
2answers
73 views

ArcGIS Extract Data Tool

I am lookinig for a way to use an AOI to search and extract data from the data drive on the network at work. So, for example, I have folders of elevation data. Instead of sorthing through each folder ...
0
votes
0answers
76 views

Error in python code for map automation (loop)

I try to make this code work but I cannot find the error (not very familiar with python) The code should basically run through a file GDB where all the feature classes are stored. It then should ...
2
votes
0answers
52 views

Inserting accumulative attribute in dynamic text element based on Date field using ArcGIS for Desktop?

I've got a line feature class that contains Date field. I've made a layout view in order to display time animation of this feature class. I've managed to enable the time option in the layer and to ...
0
votes
0answers
35 views

Automating Raster Calculator [duplicate]

I am seeing mixed answers on other posts so I thought I would ask here. Is there a way to automate the raster calculator? I am trying to create a series of inundation maps at fine increments. It ...
1
vote
1answer
102 views

Script for selective dissolving of multiple features

I am kinda new to Python and arcpy and have done some basic online courses on this. So I do have an idea how these scripts are structured/written and how they work. Now I have to perform a seemingly ...
1
vote
1answer
46 views

Read raster at request size through Python

I'm trying to read the raster (tif) file using Python. What I want is to read the raster at a specific request size rather than its original resolution. Example: If a raster has a cellsize of 5 x ...
2
votes
1answer
146 views

Arcpy: formatting string for file name

I have the following question about formatting a string which I use to create output file names. I loop a SearchCursor to create .png file. I extract two columns form the cursor e.g. "GMS_ID" and ...
2
votes
1answer
56 views

Adding new records to attachment match table from select number of features from feature class using ArcPy?

I am seeking some ArcPy/Python help. I use the mobile app GIS Pro to collect data in the field, which allows me to export shapefiles containing a field called Photos, containing a list of names of ...
0
votes
1answer
55 views

Getting wrong results in Search Cursor of ArcPy/Python script? [closed]

I have two functions: First one will crated the feature layer second one will access the same created layer and prints the result. when i run my script first time it will print the wrong results. ...
2
votes
2answers
118 views

Creating shp from txt files using ArcPy?

I have a txt file like this: Point 0 347172.2 4269952.7 60.9090909091 1 337172.8 4278952.4 85.7334909091 2 344572.3 4547952.2 123.909673091 3 347532.8 8777952.8 456.467809091 END The third column ...
0
votes
2answers
74 views

Attribute field based off intersecting polygon

I need to add a polygon for each bookmark (which works fine) and then attribute a field based off which Zip Codes the bookmark polygon intersects. I dont know if I am on the right track. The code ...
0
votes
0answers
46 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 ...