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

learn more… | top users | synonyms (1)

0
votes
0answers
27 views

SQL fails in python. In ArcMap error FDO error: -2147024871 returned

I'm having issues with an SQL expression for a feature class in a file geodatabase. When working in ArcMap, the SQL will fail on its first attempt, and produce the following error: However, when I ...
1
vote
0answers
23 views

Why is arcpy ChangePrivileges_management adding a second feature class to map?

I am new to GIS and pretty new to python, so sorry if this is ugly code. I am creating a feature class in a postgres database if it does not already exist and the user wants it created. That works ...
0
votes
1answer
63 views

cannot concatenate str and list objects

I'm trying to rename a group of rasters to "I1986_" + [The 1st 3 letters of the raster]. For example, if a raster is named "Raster1", the output would be "I1986_Ras". I've tried including str() ...
1
vote
1answer
42 views

How to replace field name with a variable in exported whereclause?

In the select by attribute how do I replace "AADT", with a predefined string variable? I don't understand the pattern in "\"AADT\">=" , can you please explain why is it that way when exported from ...
0
votes
1answer
63 views

Python Script to Select records based on user input

I am running Arc 10.3 in a versioned environment. I am attempting to write a simple code that will select service records coming from Oracle CRM to a separate feature class containing only records ...
1
vote
1answer
33 views

How to search for fields in a GDB and add them if they don´t exist with arcpy?

I have a list of files that need to be present in my featureclasses - myFields[]. I need to add these fields if they are not present in my FeatureClasses. import arcpy myField="Field01" myFields = ...
0
votes
0answers
21 views

Assign a dummy value for removed features in a Polygon-Grid

I want to calculate the entropy index for landuses classes for an area based on a 100m Polygon Grid. I did find an existing toolbox that does all the required calculation. Input features are the 100m ...
4
votes
2answers
175 views

Fastest way to numerate intersecting polygons in ArcGIS

I need to numerate a thousands of polygons in groups, so each group will get unique number. Every intersecting polygons is unique group (see picture). So polygons have field "groups" with values: ...
0
votes
1answer
54 views

TypeError: value #0 - unsupported type: datetime.timedelta

The following code runs fine minus receiving the error below, which doesn't make any sense (to me) as I have other UpdateCursors and perform UpdateRow(row) with other date values. As can be seen ...
1
vote
2answers
64 views

Export feature classes in geodatabase to CSVs

I am trying to export feature classes within a geodatabase to CSV format using "Export Feature Attribute to ASCII" in ArCGIS. I am getting the following error Traceback (most recent call last): ...
2
votes
2answers
67 views

How to access Spatial Analyst extension from stand alone script?

If I run this script: import arcpy arcpy.AddMessage(arcpy.CheckExtension("Spatial")) from arcpy.sa import Con from arcpy import env fDir=r'd:\scratch\fdir' outFolder=r'd:\aerials\images' ...
2
votes
1answer
79 views

How to use %i%“.csv” in arcpy to name an output csv file?

I am using arcpy to describe datasets and output the results into a csv file. I am doing this via a script in arctoolbox and would like to save the file in the same folder as the file being analysed. ...
0
votes
2answers
93 views

How to enter date with arcpy.GetParameterAsText with arcpy?

I want to allow users to enter a date as a parameter through a dialog window in a toolbox script. I have obviously defined the field with a "Date" data type but something is wrong with the ...
2
votes
1answer
64 views

Polygon found with search cursor, but not update cursor

Here's my issue. I am doing two things with arcpy: 1) I search a feature class using arcpy.da.SearchCursor() and pull out a UID field and the geometry in WKB format for all polygons in the file, ...
0
votes
4answers
170 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
45 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
59 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
22 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
12 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
56 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
23 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
64 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
55 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
181 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
82 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
50 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
27 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
48 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
47 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
53 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
96 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
121 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
49 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
43 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
125 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
73 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
63 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
40 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
59 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
56 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
60 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
40 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
61 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
67 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
57 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
49 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
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
35 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
33 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 ...