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

learn more… | top users | synonyms (1)

2
votes
1answer
58 views

How to reference path to file that is in edit session from Python AddIn?

I am creating a Python addin button and I would like to reference the path to the layer that is currently in an edit session to the code in the addin button. This way users will be able to use the ...
0
votes
2answers
147 views

Arcpy Insert Cursor

The below code quits at the "cur = " line. Is it an error with arcpy module, my other scripts have worked with importing arcpy. I cannot determine if it is not recognizing the 'InsertCursor'. Any ...
0
votes
2answers
197 views

ArcGIS 10.1 - Using Polygon Neighbors with dissolved polygons

I've used polygon neighbors to find all neighbors of a polygon layer, which I then use to look up all possible neighbor combinations and dissolve the polygons into all possible combinations of two ...
0
votes
1answer
114 views

Cursor not working in ArcGIS 10.2

I just simply tried print arcpy.SearchCursor(...) A 'None' was printed. But arcpy.da.SearchCursor works. Has anyone run into the same issue, or is arcpy.SearchCursor deprecated in 10.2? Thanks
0
votes
0answers
95 views

Error in Select Numeric type column in pyodbc with ArcCatalog

I created a python script that uses "pyodbc" plugin to connect a SQL Server database and write out data. It was imported in an ArcGIS 10.1 tool and run from there. try: arcpy.AddMessage('FLAG 0') ...
0
votes
2answers
44 views

Updating a Field in the Current Selection [duplicate]

I have some address points selected for which that I want to update the address field based upon the row in the selection. How do I figure out the name of the selection taable to pass to ...
0
votes
1answer
91 views

How to get cell value from one raster within a raster catalog using ArcPy?

I need to be able to obtain the cell value of one cell in one specific raster that is stored withing a raster catalog in a file geodatabase. The Get Cell Value tool doesn't appear to be able to do ...
0
votes
1answer
111 views

Dissolve multiple rows straight into one layer and add OIDs into table

I am currently running this script to direct multiple dissolves of a polygon layer FC = "BLPUsCavPlace" TABLE = "BLPUsCavPlaceContigBLPUs" FIELDS = ["blpuid", "contigid"] with ...
2
votes
1answer
128 views

Best method to select features in one fc and project to different coordinate systems?

I've got data from all over Europe in one feature class projected in Web Mercator Auxiliary Sphere. Due to the fact, that length and area values are not usable I'm now working on a python script ...
1
vote
1answer
168 views

Migration from .gdb to .mdb - how to change automaticly all querys at MXD from “ ” to [ ]?

after migration from File Geodatabase (.gdb) to Personal Geodatabase (.mdb) - how to change automatically all field names at query definitions at the MXD from " " to [ ] What's else is important ...
1
vote
1answer
93 views

Need iterator help in create near feature script

I'm having two specific problems with this python script I'm developing. Background: I am trying to generate near_tables from fc's stored in fgdb, join the near table back to target feats, and save ...
0
votes
1answer
657 views

Use arcpy.da.searchcursor to select rows to dissolve

I'm quite new to ArcGIS and hope someone can help me. I have one table that lists which polygons are contiguous with each other called BLPUsCavPlaceContigBLPUs that looks like this: OBJECTID ...
0
votes
1answer
92 views

Code in python for arcgis to select multilines (path) and vertexes

I am learning to write a python code for ArcGis 10.2. Need help! I have some shp poly lines file, need to learn how to write multiple selection of those lines, even if a cursor of mouse pressed not ...
0
votes
1answer
153 views

Copying/Projecting featureclass into a database and featuredataset of the same name fails

I've written a script in Python for ArcGIS 10.1 in order to migrate from an outdated coordinate system to a newer one while at the same time updating from personal geodatabases (.mdb) to file ...
0
votes
0answers
28 views

arcpy.ListFeatureClasses(wildcard, type, dataset) - Help with grabbing from 2 different feature datasets? [duplicate]

I'm trying to join multiple line fcs to their matching named point. (point and lines in same gdb, but separate feature datasets. stand alone python script/arcgis 10.1) My initial line of psuedocode ...
1
vote
1answer
184 views

Arcpy Error 999999: Error executing points to line. Coordinates or Measures are out of bounds

I am selecting two points from a table and then doing a points to line function. I was originally getting this error because they were multipoints with multiple locations. I ran Multipart to Single ...
3
votes
1answer
147 views

Is there ArcPy way to run Report Layout File (RLF) report and add to layout for Data Driven Pages?

I currently have a data driven page template set up which I manually cycle through and for each page run a Report Layout File (RLF) report and then add this to the ArcMap layout. The added element is ...
0
votes
2answers
84 views

ArcPy add point to a FeatureServer Layer

What is the best practice to add a point to a FeatureServer Layer using arcpy? using rest services, write to db, etc? Where can I find a code sample?
0
votes
1answer
337 views

Geographic Transformations using ArcPy vs. Coordinate Systems used by ArcGis online basemaps

I have 3 shape files with undefined projection, but I know which one it was used (Lisboa_Hayford_Gauss_IPCC). I need to 1st Define Projection. It works. I need to transform it from WGS_1984, so I've ...
0
votes
2answers
196 views

Arcpy SelectLayerByAttribute_management where_clause with LIKE not returning like values

I am selecting 2 intersections from a shape file using info from a File Geodatabase Table. The values are very similar as shown in example at the bottom. I am using a LIKE in the statement but it is ...
1
vote
1answer
127 views

pulling an excel sheet with =rand(between) in a Python while loop, and exporting results as .dbf

To preface my question: I am very new to stack overflow, and relatively new to Python. I am working on setting up a sensitivity analysis. I am working with 40 parameters that range from 0.1 - 1. My ...
1
vote
2answers
481 views

How to loop through a list of shapefiles and rename them?

I am trying to upgrade a simple script to list all shapefiles in a folder and if necessary in any folders within and then loop through the list of shapefiles and rename them. import arcpy # Set ...
1
vote
1answer
166 views

How to avoid setting env.workspace and other paths/settings all the time

I have some scripts that are constantly setting env.workspace of arcpy. Usually, I have a caller script(script1.py) that may call some other script (script2.py). I've created a file globals.py with ...
2
votes
1answer
247 views

How do I get the coordinates of my data frame always in long/lat?

I want to determine the coordinates of my current data frame. To do so I wrote this script: def DataFrame (): mxd = arcpy.mapping.MapDocument("CURRENT") df = ...
0
votes
1answer
142 views

Python workspace

I wrote a simple script to rename about 15 shapefiles in a folder on our local server. When I tested it I was working on a workspace on the C:\ and it worked fine. All our data is on a local server ...
1
vote
1answer
254 views

ArcGIS 10.1 Python script to snap points to lines

I have 2 Feature Datasets in a geodatabase. One dataset contains bus routes and the other contains bus stops for each route. I want to create a script that will snap the bus stops to the vertex of the ...
1
vote
1answer
213 views

Help with formatting ArcGIS text elements with Python

I'm struggling with a formatting issue that comes from inserting text into a Text Element object in ArcGIS using Python. I want to print a table of values of which all but the last column are numbers. ...
0
votes
2answers
71 views

Is it possible to rename a field with the current date

I'm trying to figure out if it is possible to rename a field with the current date. What I am trying to accomplish is a table to table conversion, dropping a dozen fields, leaving only two fields, ...
0
votes
1answer
196 views

Why does arcpy.mapping.Layer give Runtime error: CreateObject Layer invalid data source?

I want to connect an existing .lyr file to a variable defined as lyr2. lyr2 = arcpy.mapping.Layer(r"C:/Iso100Red.lyr") Although its a .lyr file I´ll get this Errorcode: Runtime error : Object: ...
1
vote
2answers
553 views

Importing ArcPy taking many seconds and code is really slow for GeoProcessing Tools 64-bit (ArcGIS 10.1 SP1)

I've installed ArcGIS10.1 SP1 and whenever I import arcpy (on Pywin console or Eclipse PyDev) it takes aprox. 15-20seconds. Is this normal? I don't think so... I had Python 2.7.3 64-bit previously ...
1
vote
1answer
709 views

arcpy.env.overwriteOutput = True, not working for some reason

AOI_test = "AOI_test.shp" arcpy.env.overwriteOutput = True for i in loc_list: AOI = "AOI_" + i + ".shp" arcpy.Select_analysis("locality", AOI, " \"LOCALITY\" = '%s'" % (i)) ...
0
votes
1answer
61 views

Looping on the Select_analysis tool

Im trying to perform a loop on the Select_Analysis tool in Arcgis. Code looks like this: inputfile = open("locality.txt", 'r') # locality.txt is a txt file of locality names loc_list = [] for line in ...
2
votes
1answer
185 views

Generating sequential numbering for duplicate values in a field sorted by ObjectID

I am trying to figure out a solution to an field calculation problem. What I'm trying to do is automatically (using either ArcPy or the Field Calculator) generate sequential numbers, beginning at 1, ...
1
vote
1answer
132 views

Updating the value of a field with pre-defined values

I am trying change the value of a row for a field whose type is "short" in arcmap using a python script. with arcpy.da.UpdateCursor(FILENAME, FIELD) as cursor: for row in cursor: row = ...
1
vote
1answer
42 views

Deleting the cursor object

Can someone explain why you need to delete the cursor objects and the iterator when you use for example: arcpy.UpdateCursor(blah) I've checked the esri docs and there doesn't seem to be an ...
1
vote
1answer
88 views

Stuck updating one field based on the condition of another using Acrpy or Field Calculator

I have a shapefile with 5,000 city points. I need to populate a new field, "cls_pop", based on each cities population, so that cities with a population > 2,000,000 will have "cls_pop" = 1, cites with ...
2
votes
2answers
254 views

GROUP BY clause in the UpdateCursor arcpy.da

I need to specify a "group by" clause for UpdateCursor arcpy.da. From here I found out that it's possible to do using an optional pair of SQL prefix and postfix. But there are no examples and I'm ...
0
votes
1answer
107 views

How to save all Layers in ArcMap table of contents

Basically, I'm bringing layers into arcmap,repairing the data sourc, and then saving out the layers manually so that the new source is saved. This is very time consuming because I have several hundred ...
0
votes
1answer
74 views

Is there a way to change environment settings of a dataset without creating a new one?

I am trying to change the environment settings of an existing dataset. I found a workaround by first changing the environment settings in the SDE-database and then create a new dataset with now ...
2
votes
1answer
140 views

Pythonaddins SaveDialog filter

If you look in the ArcGIS 10.1 help, the Pythonaddins module SaveDialog shows the following: SaveDialog({title}, {name_text}, {starting_location}) But if you open the python window in ArcMap, you ...
0
votes
1answer
91 views

Python: using CalculateField_management for duplicating attributes with a double quotation mark

I am writing a python script which duplicates a field. The field contains names of pipelines but some of these names has double quotation (ex. 8" NGL PIPELINE). I have created a new field and trying ...
1
vote
0answers
95 views

Need help using FieldMappings object with Append_management in Python [closed]

I have a fairly large script that I'm reworking. The script is manipulating tables with 50 or so fields. (I will be cleaning some of these up to reduce the number.) Toward the end of my script I call ...
0
votes
2answers
145 views

Python Delete point in a distance of x meters

I took this code from this source Select maximum number of points more than x meters apart It seems to work for other users, but for me it's an endless loop. I do not understand why, though the code ...
0
votes
1answer
253 views

Label Features with Arcpy

I had run the contour tool in my script to generate polylines. Contour("rectExtract", "C:/fakepath/Class1.shp", 50,0) Now I want to label the polylines with the contour-value. If I execute this ...
0
votes
1answer
53 views

Editing symbology of contourlines with Arcpy

I just have a problem with my pythonscript. I had run the Contour-tool to generate polylines. Contour("rectExtract", "C:/fakepath/Class10.shp", 20,0) Now i want to mark the 100 meter lines in ...
5
votes
2answers
624 views

How to copy an SDE geodatabase to a file geodatabase using Python?

I would like to make an exact copy (domains, feature datasets, feature classes, etc.) of an SDE database to a file geodatabase. I have tried several possibilities, including: using the Copy (Data ...
3
votes
0answers
417 views

How to rotate and move polygons to different angles using ModelBuilder (or ArcPy)?

I have a few thousand polygons (all square) that I need to rotate to various angles that are in the attribute table, and then move so that each polygon gets moved 3/4 up from the original centroid, ...
2
votes
2answers
218 views

How to edit (particularly flip direction of) polyline obtained through UpdateCursor?

I want to flip the direction of a polyline feature obtained as a result of an Update query; e.g. lines= arcpy.UpdateCursor(myFeatureClass,myQuery) dsc= arcpy.Describe(myFeatureClass) try: for ln ...
0
votes
0answers
80 views

How to find features of certain name in multiple workspaces?

I have a similar issue to these threads: How to list feature classes in multiple geodatabases in a folder? How to list Feature Classes of Multiple geodatabase in Multiple Folder? However, I want to ...
0
votes
2answers
109 views

How to limit/page through results from ArcGIS SearchCursor?

I would like to get for example, the first 200 rows from a database by ArcGIS Python SearchCursor. How can I do that? I've got a featureclass which has about 500k features and reading it all in one ...