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

learn more… | top users | synonyms (1)

0
votes
4answers
163 views

Is there a site with templates for Arcpy where I can just fill in the blanks?

I have a Shapefile containing near 7000 pour points across the globe (GCS, WGS84). I'm using the following model to select the first feature point of the Shapefile, copy the selected feature in a new ...
0
votes
2answers
42 views

Comparing field names and field formats for featureclass using ArcPy?

I have a strict data model which needs to be enforced for a project. For all featureclasses which exist, I need to check if the fields which are present conform to the data model. I want to do this in ...
1
vote
1answer
37 views

Returning feature class from Python toolbox

I am trying to return a feature class (my sample data is a polygon fc) from a Python toolbox and cannot find any information about what I have to set to get it to work. This runs successfully and ...
0
votes
0answers
21 views

How to align big polygon over smaller ones using ArcPy?

I have to write a python script which is supposed to align an area polygon on the borders of other polygons coming from a cadastral plan. These polygons come from an official source, so they are not ...
2
votes
1answer
10 views

Pass buffer as variable using arcpy.Buffer_analysis

I am trying to pass a buffer variable and seem to have run into some sort of limitation of the command. The buffer will vary each time the script is run so I need to have this parameter variable ...
0
votes
1answer
54 views

Script not working as expected

I'm newbie to python and I wrote this script. It is supposed to check the text in the fields fld_o and fld_d and write a value (just numbers in a sequence) to a newly created field fld_name. While ...
0
votes
0answers
17 views

CopyDatasets will not overwrite some datasets

I used a script from esri found here http://support.esri.com/en/knowledgebase/techarticles/detail/40831 to import all the feature datasets and feature classes from one file database to another. In the ...
2
votes
2answers
61 views

How to remove duplicate polygons having different attribute values from Python Arcpy?

I'm trying to create a national.shp to cover the entire countries land. I made index called "province" to help me update the information in my attribute table from the national shapefile. The idea is ...
1
vote
1answer
43 views

How can I dissolve adjacent polygons based on minimum attribute value? [duplicate]

I'm trying to merge the polygons (administrative boundaries) in a dataset untill they reach a minimum value. Lets say that the polygon dataset consists of the number of people per polygon and I need ...
3
votes
3answers
167 views

Is there a better way to compare lists in arcpy?

I simply want to create a script which compares a list with the field names of a featureclass and if the fields do not exist in the featureclass add them. My code works, but is very inefficient. How ...
1
vote
1answer
67 views

Listing data sources in ArcGIS map (*.mxd) without opening it?

Is there any routine I can use to read the data sources out of mxd´s without waiting 30 seconds to open each one? I need to create lists of all data sources as we are migrating data and altering our ...
0
votes
1answer
48 views

Convert field types in GDB with Python

I want to create a python script (ArcGIS 10.1) where I loop through a GDB with several feature classes and select all the fields which are of text type and convert them to float type. I always want ...
1
vote
1answer
25 views

Calculating lat/long in NAD 83 and NAD 27 using arcpy or modelbuilder

I have four double columns for lat/long with NAD 83 and NAD 27. The native projection of the data is in NAD 83, but the client want's the attributes filled out for NAD 27 as well. I want to ...
0
votes
1answer
37 views

Arcpy scripts run time dialog keeps deactivating tkinter window

I'm using tkinter in my scripts to get field names of the user in case the hard coded field names were not found in the target feature. it runs from python IDE, but when run from arcmaps toolbox the ...
0
votes
1answer
33 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
44 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
81 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
109 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
44 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 ...
1
vote
1answer
26 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
64 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
51 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
58 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
38 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
50 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
54 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
47 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
27 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
55 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
61 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
53 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
39 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
25 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
35 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
34 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
27 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
36 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
140 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
59 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
83 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
52 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
54 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
69 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
86 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
49 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
25 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
82 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
52 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
51 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 ...