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

learn more… | top users | synonyms (1)

1
vote
1answer
182 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
146 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
332 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
193 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
466 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
162 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
236 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
140 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
248 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
211 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
194 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
548 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
696 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
60 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
181 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
130 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
85 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
252 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
106 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
133 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
94 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
251 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
604 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
407 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
215 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
79 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
108 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 ...
2
votes
1answer
126 views

Using Sum() or something similar with CalculateField_management and FieldLists

I need some help with using variables with CalculateField_management tool. I've tried several different scenarios but don't seem to have any luck. What I have is a list of fields containing water ...
1
vote
1answer
320 views

ArcMap Crashes because of increasing memory usage

Hi I have this code and I tried to delete all the layers it creates to enhance it's performance...However ArcMap crashes after about 200+ files. I am new to the subject but I checked the internet for ...
0
votes
1answer
138 views

ArcGIS Python Script Buffer [duplicate]

I have a problem, I'm trying to create a buffer as part of a code but I keep getting the following error: ExecuteError: Failed to execute. Parameters are not valid. ERROR 000735: Distance [value or ...
0
votes
1answer
116 views

How to set coordinate system on raster catalog with arcpy?

When creating a raster catalog, if the optional coordinate system fields for the raster and geometry columns are left empty, they will be stored as unknown. What geoprocessing functions in arcpy ...
2
votes
1answer
200 views

Trouble formatting SQL expression for where clause in “Search layer by attribute” arcpy function

I am trying to pass a variable into a where clause in the "Search Layer by Attribute" arcpy function. I cannot seem to figure out the correct format for the SQL expression so that the function reads ...
1
vote
2answers
273 views

Python code does not work with RasterCalculator after exported from Model Builder

I have a model authored in Model Builder that uses "RasterCalculator" to process input raster datasets. arcpy.gp.RasterCalculator_sa("OutRas = Con(\"%STATIC_forestland%\" == 0, -255, ...
0
votes
1answer
178 views

ArcPy Create Point Along Line A Specified Distance From A Specified Point

In ArcGIS Basic I am trying to take a road polyline(one segment for the entire length of road) and get a point placed on the map a specified distance from an intersection. I have a layer of ...
0
votes
2answers
175 views

Help writing script using a shapefile - select by attribute

I am trying to take an existing shapefile and narrow down the attributes using the 'select by attribute' The problem I am trying to solve is: Find parcels that have an acreage >= 100. The code I ...
1
vote
1answer
191 views

How to list raster bands?

I am interested in looping through a directory and listing only the red bands (Band 1) from 4-band NAIP imagery. From there I would like to mosaic all of the band 1 layers into a new single band ...
2
votes
0answers
79 views

Call ArcPy script via CGI on IIS

I have an ArcPy script that does a whole bunch of processes with ArcGIS 10.1 to write the output data to a SDE geodatabase. What I want to achieve is to enable an online user to call the script and ...
-3
votes
1answer
110 views

How to create a polyline feature from a point layer

I would like to create a route line based on a point layer. The existing tool does not meet the customer requirement. But using the code snippet below, the start point and end point are always the ...
2
votes
2answers
312 views

How to set linear units for Buffer distance from arcpy.GetParametersAsText()?

I am trying to run a buffer tool as part of script that I will both use as a standalone script and import into ArcToolbox. I'm just wondering, if I use GetParametersAsText for the buffer distance, how ...
5
votes
1answer
296 views

How to arcpy.Describe() a layer when script is run from outside of ArcMap?

The following code will work if I run it from the ArcMap Python dialog, or from a GP tool, but not from PyScripter IDE: import arcpy mxd = ...
1
vote
1answer
78 views

How to create point features from 1-Many relationship?

I have an address point shapefile for buildings in a city. The point shapefile shows only a single point for each building; apartments are listed in a table called additional addresses. I need to ...
0
votes
1answer
68 views

Help with Point on Polygon overlay in ArcPy

I am trying to do this simple task but not sure how to do this in Python. I have a point shapefile and I want to overlay with polygon layer to get all the polygons for each point. After this would ...