A python API created by ESRI to perform geoprocessing and layer management.
3
votes
1answer
130 views
Arcpy does not execute “CopyFeatures_Management” to write a featureclass to an ArcSDE database
I have some problems with my Python script. The script gets an JSON with different information about images. The information includes general information about images and also the gps position of ...
2
votes
1answer
76 views
Select and zoom python script
I am attempting to make a simple select and zoom python script for my address points. Currently the script will complete successfully but will not select or zoom to the entered point. I am using two ...
2
votes
0answers
56 views
Can not get text element to update?
I can not get text element to update?
Text ELement has been added "Subdivision" Still not updating?..
class ButtonClass2(object):
"""Implementation for FemaMapper_addin.button (Button)"""
def ...
1
vote
2answers
95 views
Select Layer by Location - Arcpy - Why are my inputs being interpreted as invalid?
I am working on a tool in a python toolbox and am totally confused about what is going on and causing my select by location operation to fail (Error 000368).
I am trying to select the features in one ...
0
votes
1answer
50 views
How to add a table into the TOC in a Python script?
I recently experienced some troubles in adding a table from a specific folder to the TOC using a Python script.
Any idea on how can I solve?
Thanks, Annalisa
4
votes
1answer
92 views
Slow performance on splitting a shapefile by attributes
I've tried to develop some workflows with the ArcPy module for splitting a shapefile based on the unique values in a specified field. The code works as expected except one thing I am not able to ...
1
vote
0answers
46 views
Script Tool Problems ArcMap 10.0
I Have a scipt tool that runs when input shape files are added from the table of contents (added from drop down menu.) However this tool will not run when they shape files are added using the add file ...
5
votes
2answers
109 views
Exit Python script in ArcGIS 10.0
I have a script with an bail-out function like so:
def die():
from sys import exit
exit()
Occasionally in the script I check a condition and exit if necessary. This works great in 10.1, ...
1
vote
1answer
143 views
arcpy points in polygon check
I have a list of points and a list of polygons both in a separate shape files. I am trying to write a ArcPy script to loop through the points, and then the polygons respectively and tell me when a ...
2
votes
1answer
141 views
How to access all mxd files in a folder?
I'm a beginner to Python and am trying to figure out how I can access several mxds in a folder. For example, when I want to use the AnalyzeforMSD function in ArcGIS:
import arcpy
mxd = ...
2
votes
1answer
136 views
Help with Python script for exporting mxds into pdfs!
I have written a python script to export my mxd into a pdf (not using data driven pages). I am getting the error that my mxd path is incorrect! I have included my script below. Any help would be ...
0
votes
0answers
56 views
Import Cad Annotation - unable to get an ArcGIS 9.2 script to function with ArcGIS 10.0
Here is a snippet from the functioning ArcGIS 9.2 script:
for item in lst_dxf_o_files:
gp.MakeFeatureLayer_management(item + os.sep + 'Annotation', 'tmp_3rayon_lyr', "UPPER(layer) ...
0
votes
2answers
145 views
Changing field type with arcpy
What I need to do is change data type of a field of a table or feature class. If there are some data, then I need to transfer it, if its possible, if not possible then just set null for that data. I ...
1
vote
1answer
256 views
Python - read shapefile .dbf for encoding
I've written a python script that formats a .shp such that its fields structure matches my office's database view in order to ingest the data of said shapefile. This original shapefile was encoded ...
9
votes
3answers
327 views
Industry-based examples of using Python in geoprocessing and arcpy
I was asked recently by some students what types of operations GIS Analyst/Developer are usually trying to automate by using Python with geoprocessing in ArcGIS and ArcPy site package. I guess it ...
1
vote
1answer
133 views
Calculating mean upslope aspect
I am trying to write a python script to calculate the mean aspect upslope from each cell in a DEM. I have the general workflow down, but my final output is restricted to angles between 0 and 90 ...
3
votes
4answers
440 views
Renaming a field using arcpy
What I need to do:
rename a field name of a table/feature class
copy all values to the new field
So far I have done following code as artwork21 suggests:
EDIT:
import sys
import traceback
import ...
0
votes
0answers
22 views
ArcGlobe Disable texture downscaling programmatically (with ArcPy)
I am trying to automate the disabling texture downscaling for all of the multipatch features in an existing ArcGlobe project (.3dd). The manual way to turn off this feature for every feature without ...
7
votes
2answers
112 views
How to remove spikes in polygons with ArcGIS 10/Python?
In the picture below you can see a polygon layer, representing steep slopes, extracted from a TIN. The polygons have a lot of spikes in them. I would like to remove these spikes while the rest of the ...
1
vote
1answer
104 views
ArcGis 10.0 SP5 - Drag & drop support vs tool parameter types
I got a custom Python-tool, and one of the parameters is a (multivalue) "File" type parameter, filtered on a given set of extensions.
Also, I got users requesting drag and drop; dragging files from ...
2
votes
1answer
72 views
Error 010240 with ZonalStatistics
I have a code that calculates the sum of water recharge for a pixel for a 9 year period (This piece of code works fine, just thought I would show how it is made just in case. The values range from 0 ...
0
votes
1answer
114 views
Points in Polygon Count: Error with arcpy.selectLayerByLocation_management
I'm working on generating some multivariate hexbins and am running into a problem with the initial step of counting the number of points (for the first variable) that are within each hex polygon. Here ...
2
votes
1answer
86 views
Difficulty converting standalone script to ArcGIS tool
As my title says, I am currently trying to make my (working) standalone script into an ArcGIS tool so I'm not the only person in my office that can use it. It essentially selects all the data within ...
2
votes
1answer
171 views
ArcGIS ArcPy: Iterate over shapefiles and report field “Desc” Length
I've just started learning to script using python, i.e. no programming experience. I need to iterate over a folder that contains multiple shapefiles that all start with nlc... I need to iterate over ...
1
vote
0answers
50 views
Are multiple separate feature classes more efficient than repeatedly deleting all features from the same feature class?
Quick Version: Is it more efficient, in terms of database performance, to have multiple separate temporary feature classes or one feature class that you repeatedly empty out and fill?
I am working ...
0
votes
1answer
92 views
Clip data and add layer to second dataframe using python Add-In
I want to clip a layer from data frame 1 and add it to the data frame 2 using the following script. But instead it just add all grids to current data frame 1 and don't update data frame 2. Please ...
2
votes
1answer
73 views
Copy two datasets that particpate in the same relationship class
I have an ArcSDE GDB that looks something like this:
++ GDB
+++++ Dataset1
++++++++ FeatureClass1
++++++++ FeatureClass2
+++++ Dataset2
++++++++ FeatureClass3
++++++++ FeatureClass4
+++++ Table
+++++ ...
1
vote
2answers
90 views
Can you use arcpy.Copy_management() with in_memory tables?
I have a table in an ArcSDE GDB I'd like to step through using Python. For performance reasons I wanted to load it into memory like so:
arcpy.Copy_management('C:/GDB.sde/MyTable', ...
0
votes
1answer
87 views
Stop a Cursor loop when only 1 item is selected with Python
I am trying to create a Cursor that goes through a selection process and stops looping when only one feature is selected. Basically, as the Cursor loops it subsets a selection, and instead of going ...
5
votes
1answer
214 views
ArcPy script causing python.exe to stop working (memory issue?)
I have a script written in Python that uses ArcPy to create maps of the kernel densities of thousands of datasets. Each dataset is relatively small, but there about 50,000 sets in total.
When I run ...
5
votes
2answers
141 views
Make Buffer like Offset in Arcpy
I would like to make a buffer for a polyline and get as Output a Polygon with the same angles as the polyline, having not arcs, like in ordinary buffers.
i tried the FLAT option in arcpy, but it's ...
1
vote
2answers
61 views
Raster dataset doesn't exist error
Dataset exist and I am able to get statistics from ArcGIS python window. But it failed as a script with error:
ERROR 000865: Input raster: C:\temp\ras does not exist.
I have tried following ...
1
vote
0answers
56 views
Is there an inbuilt arcpy method to insert a new line? [duplicate]
I need to extract a list of all the files and folders within a top level folder. My first thought was to use os.walk in a small python script as it is a simple task. However, I cannot run scripts on ...
2
votes
1answer
267 views
Can't import arcpy in IDLE, pyscripter, or even ArcGIS10.1's Python window
After using arcpy and python for months with ArcGIS 10.1 without any problems I'm encountering something I can't work around or even find help with online. Something as simple as "import arcpy" is ...
2
votes
1answer
127 views
Create a shapefile from geometry
Please excuse my lingo, I am still learning some aspects of geo spatial and arcpy.
I have a python script that takes a shapefile. The shapefile consists of a polyline. I have traversed the polyline, ...
3
votes
2answers
104 views
ArcGIS Conflation Tool Recommendation or Custom Script for Comparing Points
Can anyone recommend conflation tools for ArcGIS Desktop (10 or 10.1, paid or free) or a scripting outline / procedure (or just a script) to have a technician efficiently process the following rules?
...
5
votes
2answers
123 views
SelectLayerByLocation not Selecting
I have been trying for some time now to create a script to extract the polygons within an extent, but am unable to get the same result as when I use the user interface manual method.
Maybe someone ...
2
votes
1answer
79 views
Import only necessary arcpy modules?
I'm working on a standalone script where I need to import arcpy. This usually takes close to 10 seconds, which is a little more than ideal. I'm only using a few Data Management tools and some base ...
2
votes
1answer
39 views
sr.lock after looping
The following code puts an sr.lock on each table in my List. What’s causing my tables to lock up? I understand my script is reading or opening my tables temporarily to perform the ...
3
votes
1answer
174 views
How can I more efficiently select related records?
Below is the code I'm using to replicate the "related tables" button in ArcMap. In ArcMap that button selects features in one feature class or table based on the selection of features in another ...
0
votes
2answers
96 views
How do I construct a file path within Python for a Feature Class within a Feature Dataset?
Based on my understanding of the ArcGIS path structure, a feature class inside a feature dataset inside a geodatabase can be accessed by the following:
C:\Menu\Lunch.gdb\Sandwich\Cheese
Where ...
2
votes
3answers
223 views
How to use ArcGIS 10.1 to make Python scripts for ArcGIS 9.3?
Recently I have been making scripts to run geoprocessing tools for a client who is running ArcGIS 9.3. However I only have access to ArcGIS 10.1. As a result I cannot use model builder in 10.1, and ...
0
votes
1answer
51 views
How to detect(condition) if Query Layer Connection is failing?
I have a job (arcpy script) which relies on a query layer but it fails sometimes. It has to do with the query layer connection (the point where job fails randomly)- which is totally under the control ...
3
votes
0answers
141 views
Reset python add-in
I have a toolbar which enables a second and third combobox when a selection is made on the previous. I would like to add a button to 'reset' the toolbar. Basically reload the toolbar to it's original ...
1
vote
0answers
74 views
ArcPy 10.1 PointGeometry.projectAs()
I'm trying to reproject an X,Y passed in from an Add-in.
So far this works fine:
pointGeometry = arcpy.PointGeometry(arcpy.Point(x,y),srIn,False, False)
projectedPoint = ...
1
vote
1answer
100 views
Using an arcpy cursor: How to define the actual visited feature as current selection of the layer?
I want to implement a script that runs through each feature of a feature class, zooms to the extent of the feature, sets the scale to 1:5.000 and adjacent takes a picture of the scene. The steps are ...
3
votes
2answers
229 views
arcpy.da.SearchCursor - unique value get second field value
I have a feature class and using arcpy.da.SearchCursor I'm getting unique values of a field (e.g. Name). How can I use this method to get the associated row value of a different field (diff field = ...
0
votes
1answer
223 views
Find and Replace data source script
The following script is supposed to find and replace all shapefiles in a mxd (that exist in the folder) to the new SDE data source. No errors when running the script however, when I open the MXD in ...
2
votes
1answer
174 views
How to buffer a point in a Python Add-In by ArcMap's selection tolerance?
In this answer to another Python add-in question I suggested supplying a search_distance to the SelectLayerByLocation function in order to allow points and lines to be selected by an intersecting ...
3
votes
1answer
103 views
Beginning Arcpy: Asking for a quick review of my script
I cobbled this code together from ESRI documentation and stackexchange answers.
I tried to use SearchCursor(points, fields=fieldname) but I get this error:
TypeError: SearchCursor() got an ...

