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

learn more… | top users | synonyms (1)

0
votes
1answer
78 views

make a selection by attributes of the fourth part of a range of numbers with arcpy

I am using Arcmap 10.1 and I need to create a script (for use on shapefiles) where I have a input field named "sequence" which is numerical data. I need to select the fourth part of a range of ...
2
votes
2answers
171 views

How to add values in X column to dictionary or list using ArcPy?

My apologies if this question has been asked before. I've spent some time searching for a similar question with no results. Is it possible to add each value under X column to a list using ArcPy? I ...
1
vote
0answers
38 views

How to find out which layer had a Selection made on it? [duplicate]

If the user makes a select using arcpy.SelectByAttribute() or arcpy.SelectByLocation() how do you find out which layer they made the select so you can use arcpy.SearchCursor(layer)?
0
votes
1answer
65 views

Is there an event handler for a Selection being made using ArcPy?

I want to be able to capture an arcpy.SelectByAttribute() or arcpy.SelectByLocation() event being triggered. There doesn't seem to be an extension that is able to handle this. Is there a way to do ...
0
votes
1answer
247 views

How to turn off layers in ArcMap via arcpy?

I'm working on a script in ArcMap 10.1 that takes a screenshot and I need to know how to extinguish (turn off) a layer in my table of contents.
1
vote
2answers
167 views

How do I execute a script in the arcpy window?

I've been writing python in my text editor so I have a python script, script.py. I'm still developing it so don't want to put it in my toolbox yet, and at the moment this means copying and pasting it ...
1
vote
0answers
208 views

Arcpy Spatial Join Running Extremely Slow [closed]

I have a simple arcpy script that runs a series of spatial joins. However, the script is running extremely slow: one set of joins takes over 12 hours. There are a few for loops, but I have timed these ...
0
votes
0answers
24 views

ImportError: No module named arcpy - ArcGIS 10.1 and Python 2.7 [duplicate]

Traceback (most recent call last): File "C:\Python27\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript exec codeObject in __main__.__dict_ File ...
1
vote
1answer
288 views

Field Filter and Value Pick List for an Arcpy Toolbox ValueTable Parameter

In an ArcGIS Python Toolbox (pyt file), how do I specify a filter for a Value Table parameter? In my value table I have two columns. The first is a a field name derived from a selected table view and ...
0
votes
1answer
48 views

Is the loop in this python code breaking because of duplicate values in the column?

This code is meant take a shapefile in the current mxd, loop through all of the values in a collumn of said shapefile. For each value it will create a definition query, zoom to features then save a ...
1
vote
1answer
135 views

How to zoom to layer with page definition query set in arcpy?

I have data driven pages enabled on a mxd, with a page definition query set on one of the layers to only show features that match the current index feature. This layer looks like this: After ...
0
votes
1answer
88 views

Error with save path. Does not exist or is not supported

The final save raster file errors without message with Does not exist or is not support. But it does exist. If you can find anything wrong with this script I would be very greatfull. I had a vast ...
2
votes
1answer
343 views

How to use GROUP BY with arcpy.da.SearchCursor in file geodatabase?

fc = "C:\Users\AuxS3-4\Documents\ArcGIS/Default.gdb\Malla" fields = ('OBJECTID','Sentido','Carriles','idMalla') sqlclause=(None, "GROUP BY Sentido") cursor = arcpy.da.SearchCursor(fc, ...
1
vote
2answers
183 views

How do you get all the results from a Selection made by Attribute or Location using ArcPy?

Using arcpy I'm trying to get the results of a selection, or what is currently selected as a list. Basically I'm attempting to build an addin which on click will either perform an operation where I ...
7
votes
2answers
158 views

How to specify unit of measurement when accessing Geometry() object's 'length' attribute?

Using the CalculateField_management tool, one can specify the unit of measurement when calculating shape length: #Calculate polyline lengths in miles polylines = "C:\sampleShape.shp" ...
1
vote
1answer
95 views

How to retrieve the year from a date format?

I'm attempting to retrieve the year from the following date format: 1/1/1988 I've tried the following but it does not work str(1/1/1988)[4:] and I've also tried str(1//1//1988)[4:]
0
votes
1answer
87 views

ERROR: “Can't save to disk (check for space, write permission, or name)” while creating TIN in memory

I get the following error while creating TIN in memory : ERROR 999999: Error executing function. Can't save to disk (check for space, write permission, or name). Failed to execute (CreateTin). I ...
1
vote
1answer
291 views

How to create a feature class in memory?

I am trying to create a feature class in memory but I am not sure how to use the syntax. My code looks like this: FC = arcpy.CreateFeatureclass_management("", "in_memory/FC", "POLYGON", "", ...
1
vote
1answer
131 views

How to batch split feature classes using Arcpy?

I want to bath split analysis tool using Arcpy . I have some feature classes in a feature dataset.I want to Split All of feature classes uisng a shapefile but after split two feature classes, the ...
0
votes
0answers
55 views

Using arcpy.GetRasterProperties_management gives strange results

I have a loop which goes through folders and do some raster operations. Inside this loop I checked for a raster properties using arcpy.GetRasterProperties_management with NODATA parameter. And then ...
1
vote
0answers
72 views

Why might ArcPy, TableToTable, MakeQueryTable and ArcSDE have performance issue in IDLE?

I have written a Python script tool to do: Make Query Table Table To Table (with fieldmapping). The code is nothing more than arcpy.MakeQueryTable("table1;table2;table3", ...
1
vote
1answer
120 views

Select a single entry using SearchCursor and create variable

I am trying to select a single entry of a floating point entry in a dbf table that contains 9 entries (sampled from a raster image), some of which is NULL using SearchCursor. I want to select one of ...
0
votes
0answers
66 views

Compare cell value of a row

How can I compare the cell value of row(n) with cell value of row (n+1){where n = 1, 2, ...} import arcpy arcpy.env.workspace = "C:\RG\Kings County\Test.gdb" inFC = arcpy.GetParameterAsText(0) inFC ...
2
votes
1answer
53 views

arcpy array: trouble with reassigning inf to 0

I've converted rasters to arrays via arcpy.RasterToNumPyArray() then divided them by 1. Some resulting values are zero and I need to reassign them after the division to zero. The array types are ...
1
vote
1answer
67 views

Field does not get updated with Geoprocessing Service

Can anybody tell why the field gets updated when I run this script in ArcMap but not when I run a geoprocessing service? Thanks #Import modules import os, sys, arcpy, traceback, arcgisscripting gp ...
0
votes
1answer
157 views

“shutil.rmtree” doesn't get rid of my intermediate folders

I have a script that works fine, but now I'd like to remove all the intermediate folders I created therein in order to save memory and to be clean. I've been trying using the "shutil.rmtree ()" ...
1
vote
1answer
107 views

Problem in saving a file in a specific output folder

I have a very simple script that I'm testing. It has always been working so far, but now I'm running in an unexpected error. When I try to save my files in a folder different than the environment one, ...
2
votes
2answers
50 views

Is there a way to replace just a specific character in a variable? [closed]

Here is an example township = township[3].replace("0", "") My goal being that if 10.0 is the current value for township I want to remove the zero after the . but not the one after the 1 with the ...
0
votes
1answer
201 views

Arcpy CalculateField using formatting syntax

I have 2 feature classes (FC) that I am merging together and then performing some field calculations on. The 1st FC has 100k+ records in it, and the second FC is a blank FC that I'm using as a ...
0
votes
3answers
221 views

Arcgis CopyFeatures tool extremely slow when exporting to SDE

I have about 10 points in a file gdb that I am attempting to copy over to an sde feature set. In arcpy and in model builder it takes about a minute to execute. Do you know of any tips to speed this ...
1
vote
1answer
51 views

Why does the ArcMap exported KMZ always show my local path information when displayed in Google Maps API?

I used ArcMap (arcpy) to export shapefiles into KMZ and then display them via Google Maps API v3. It looks fine initally: But when I hover my mouse above the KMZ and click it, it will alway show my ...
6
votes
2answers
191 views

What technology is used behind arcpy cursors?

I'm using ArcGIS Server 10.0. I have a geoprocessing using arcpy search, update and insert cursors. I'd like to know more about the technology behind these cursors. Does it use any driver or pool to ...
1
vote
0answers
131 views

merge_management

Here is the edited code: import arcpy import os from arcpy import env set the environment settings env.workspace = "C:\RG\Kings County\Test.gdb" fcs = arcpy.ListFeatureClasses("Sub_NVF_*") ...
6
votes
1answer
120 views

How to access current job id from geoprocessing script running on esri server?

I want to programmatically access the current job id of a geoprocessing script running on ESRI 10.2. The script is what needs to know the job id, not the caller of the script. While searching, I ...
0
votes
1answer
116 views

Problem with converting rasters to arrays and adding them to main array, then converting to raster via NumPyArrayToRaster : output is NoData values

I have a process that aims to loop through a list of rasters (testing with only 3) covert each raster to an array, add the array to an existing 'template' array, then save the final array back to a ...
3
votes
1answer
384 views

Getting the name of the mxd using python

I have a python script which reads through all the mxd's in a folder and changes their properties from relative file paths to absolute file paths. I now want to add a bit to the script to change the ...
1
vote
1answer
123 views

Python Field Calc for Document Hyperlink

I am trying to create a script that will hyperlink to a .tiff or .pdf. These files are stored in one folder on a shared server. I want the script to look in a field: 'PLAT_IMAGE', which has the plat ...
6
votes
1answer
161 views

Draw middle ordinate perpendicular to chord, out to curve, with arcpy

I've been assigned to find the radius of road curves. My boss found this article describing a pretty straightforward method of doing so: find the start/end points of the curve; create a chord; ...
3
votes
2answers
112 views

How can I generalize “field name” variable?

Here is my code: import arcpy import math arcpy.env.workspace = "C:\RG\Kings County\Test.gdb" fcs = arcpy.ListFeatureClasses("NVF_*") try: for fc in fcs: rows = arcpy.UpdateCursor(fc) ...
2
votes
2answers
257 views

How to select specific filenames nested within several folders?

I have hundreds of shapefiles that are stored in separate folders, which are nested within several other folders. Among the shapefiles I only need the ones that are named 'POINT*.shp' How do I get ...
5
votes
1answer
148 views

Does arcpy have a method for accessing related records within a cursor?

I have a line feature class that represent sampling segments. I have a data table of field notes in the same Geodatabase that is connected to the feature class with a Relationship Class. Is there a ...
1
vote
0answers
73 views

Import related CSVs to geodatabase without losing foreign key relationships

For various reasons I understand it is poor practice to rely upon OBJECTID fields to relate different tables together using a relationship class. Therefore, I have a series of several tables related ...
1
vote
2answers
118 views

How to query a data table embedded in ArcPad AXF file package using VBscript?

I would like to ask for some help on writing some VBscript (Supported in ArcPad) in a user form Command Button where the user activated the form with a unique feature ID(hence named COA_ID) already ...
3
votes
1answer
331 views

How to export a mxd to a image with transparent background

I cannot get ArcMap 10.0 or 10.1 to "Export Map" to a png or gif with a transparent background -- no matter what I set the background and transparent colors to. Thus, I created the following script, ...
1
vote
1answer
112 views

Copy specific cell value from one feature class and append to another feature class

I want to copy specific cell value from one feature class and append to another feature class. I have the following code, however, when I run this, it does not produce the results, nor shows any ...
1
vote
1answer
452 views

Calculate coordinates of centroid in arcgis using python

I have polygon features and want to calculate coordinates of it's centroids in arcgis using python - all goes fine, but it gives me coordinates in meters and not in degrees as i want. Here is the ...
1
vote
1answer
76 views

How to add ArcPy Feature Layer to ArcMap automatically?

With Python, how do I get either the MakeXYEventLayer_management or the MakeFeatureLayer_management layer that is temporarily created added to ArcMap automatically after the tool is ran, without using ...
2
votes
0answers
30 views

Generating composite values ( MAPFID numbers) for previously duplicated vales based on 2 different fields

Good day everyone! I have lurked around here for info preiously, but this is my first post, so please be gentle if I commit any faux pas. Okay, let me try to break this down so we can all ...
4
votes
2answers
291 views

Focal statistics to calculate saddle points from DEM

I have a conundrum with Focal Statistics and kernel files. I am been trying to identify saddle points in DEMs. I am attempting to rewrite this (thanks whuber) in a python script for 10.1. I have ...
0
votes
1answer
95 views

How to filter shapefile using definition query?

I have a point shapefile which I want to interpolate using IDW interpolation. However, I want to interpolate only those points which satisfies a certain condition. I need to do it in python and I ...