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

learn more… | top users | synonyms (1)

7
votes
1answer
1k views

Why can't I access a table in a personal geodatabase (.mdb) with arcpy after installing 64-bit geoprocessing?

I wrote and ran a simple script last year - it cycled through some line features, buffered them and then intersected with some other lines - it all worked fine. I'm now trying to tweak the file to ...
3
votes
2answers
153 views

Polyline in shapefile

I'm still pretty new to arcpy and am still learning. I'm working on a script that has a polyline as its input. I'm able to traverse the polyline and get points at certain intervals. These intervals ...
1
vote
0answers
96 views

Is segment of polyline contained in polygon

I am pretty new to arcpy and am slowly learning all its functions. I have a scenario where I am traversing a polyline. I get a start point and an end point on the polyline and form a segment with ...
3
votes
1answer
176 views

Exporting records from an attribute table and placing them in a txt file

I am trying desperately to grab records in a shapefile's attribute table and copy them, with additional formatting to a txt file. Below is the code I have developed thus far: I have used the ...
3
votes
1answer
588 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
154 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
186 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
699 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 ...
1
vote
1answer
275 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
244 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
61 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
236 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
612 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
423 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
516 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
2answers
951 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 ...
2
votes
1answer
724 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 ...
11
votes
3answers
613 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 ...
2
votes
1answer
425 views

Calculating mean upslope aspect from each cell in DEM using Python?

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
5answers
4k 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 ...
4
votes
1answer
691 views

Refresh combo box in add-in

I've got an add-in with a combo box and want to refresh the list in the combo box after an event in one of the other tools in the same add-in toolbar. Can I call the combo box somehow to refresh it ...
8
votes
2answers
433 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
442 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
205 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
520 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
204 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
831 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
83 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
231 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
203 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
462 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
270 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 ...
6
votes
1answer
711 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
556 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 ...
2
votes
3answers
389 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
108 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 ...
3
votes
1answer
1k 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
400 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, ...
4
votes
2answers
412 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
323 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
128 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
79 views

What is causing sr.lock on tables 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 ...
6
votes
2answers
2k 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 ...
1
vote
2answers
442 views

How do results from a Python script get added to an ArcGIS map? [duplicate]

I have a Python script for ArcGIS that makes a new feature class. I can add this to ArcGIS as a new Script (without parameters), however the resulting feature class is not automatically added to the ...
2
votes
2answers
689 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
1k 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
85 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
525 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
373 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 = ...
2
votes
1answer
372 views

How to use ArcPy cursor to define each feature sequentially as current selection of 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 ...