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

learn more… | top users | synonyms (1)

1
vote
2answers
384 views

Reducing number of decimal places after X/Y coordinates in a FC

I'm using arcpy.AddXY_management to add coordinates, and I want to reduce each X/Y field by x number. I've tried to reduce it by string slicing and that obviously didn't work. I also tried setting the ...
1
vote
1answer
236 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
750 views

Copy features from feature class to an existing feature class with arcpy

I see CopyFeatures_management, but this creates a new feature class. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001700000035000000 Is there a way to copy features from a feature ...
1
vote
1answer
396 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
59 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
294 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 ...
1
vote
5answers
938 views

String variable substitution in selection expression

I'm trying to put a variable into a string used to do a selection. At the moment it's like this... expression = "'No_Props' > 5 AND %s < 200 AND 'ST_Ori' >60" % metres_field ...
1
vote
2answers
509 views

ArcPy Field Calculation with special characters

I'm trying to calculate a string field, using "µSv/h". Running this in the manual field calculator works just fine, but I've tried this in the Python window in ArcMap as well as the IDLE, but both ...
1
vote
2answers
97 views

Select individual lines from feature class, convert to unique rasters: “raise e” error?

I have a feature class with 5 lines in it, and need select each one and turn them into its own raster -- for example, line 1 is raster 1, line 2 is raster 2, etc. This is the python script: import ...
1
vote
2answers
185 views

Set Extents of MXD to new layer data source?

Alright here I go again this forum has been good to me. I add a layer and replace its data with a shapefile I created using the following bit of python: layer = ...
1
vote
2answers
2k views

How to list Feature Classes of Multiple geodatabase in Multiple Folder?

I'm new in python scripting and try to list polyline feature classes of multiple Geodatabases. The Geodatabases are in many nested folders.For example in folder "A" I have 20 folders and in each ...
1
vote
2answers
417 views

How to Append to rather than overwrite single table using ArcPy?

The code thus far works to create multiple output files, but I'd like to set it up so that the data is all exported onto a single table across multiple rows. The issue is I believe with the part in ...
1
vote
3answers
766 views

How to create a spatial reference file

I am using python, arctoolbox and arcpy 10.0 I am running a script that is tied to an arctoolbox. The toolbox serves to enter in my parameters. I have a feature layer as an input. The feature layer ...
1
vote
1answer
989 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 ...
1
vote
1answer
159 views

cannot print listRasters

I'm trying to run this very simple script to check a problem in another more comlpex one. import arcpy arcpy.env.workspace= 'C:\\Users\\Umberto\\Desktop\\Prove_Script\\Karakoram\\temporary_01' rst= ...
1
vote
1answer
2k views

Looping through multiple feature datasets and Intersect Files?

I am getting an error with a python script I have created. I have 1 geodatabase with 3 feature datasets. What I would like to do, is loop through 1 feature dataset (NB) to get a list of feature ...
1
vote
1answer
496 views

Using arcpy.Exists for domains?

A script I made creates domains within a selected geodatabase. I need it to not create the domains if they already exist because if they do, it gives an error saying invalid domain name. Is there ...
1
vote
2answers
1k views

How to Set up Data Driven Pages using arcpy?

I've read a lot about the topic data driven pages. I'm writing a python script for ArcGIS and I've defined my stripmap using the arcpy.StripMapIndexFeatures_cartography command and now I have to set ...
1
vote
2answers
904 views

How to automate relative filepath when adding a new toolbox to the arcmap catalog?

So I'm creating an arcpy script for a custom toolbox and I want to make it so that a user can essentially utilize the script in that toolbox without having to change the source path (which I made ...
1
vote
2answers
207 views

ArcPy Result Object Associated with Currently Running Script

We are at the end of a Python script using ArcPy. We can crawl around ArcPy to get information, but is there any way to get a result object for our currently running script? My motivation is to use ...
1
vote
1answer
47 views

why does my script not save a layer when it encounters a “ \” character in the string

i have some code that takes a field and finds every unique value in that field. it then creates a layer for each unique value. The code is working ok , but it is failing when there are \ characters ...
1
vote
1answer
42 views

Stand alone - Python Append (multiple shps from a folder to one dataset)

I have users creating data (shp) daily into a specific folder, I already know how to invoke GP tools to append these data sets into one. What I am trying to do is run a task (which I already know) to ...
1
vote
1answer
51 views

ArcGIS python script validation to update the text based on a list

I'm having issue with using validation to update an input box. Some background: I created a tool to update and resize text in ArcGIS. This is done by having a series of text elements and shape ...
1
vote
1answer
41 views

Why is Update Cursor adding Object IDs incorrectly?

I am using an update cursor to add values in a try:except block of code using ArcPy. If the code is successful I log yes in the success field, if it reaches the except block I log yes in the fail ...
1
vote
1answer
20 views

arcpy.GetCount_managment not returning result in dialog window

I am having trouble with GetCount to work in my script. It is not printing the GetCount arcpy.AddMessage in the geoprocessing window dialog; # Get the spatial reference spatialRef = ...
1
vote
3answers
69 views

Removing filepath from ArcGIS geoprocessing result?

This is my python script code in ArcGIS 10.3; projectResult = arcpy.Project_management(fc, outFolder + "\\" + fc, template) #Name of shapefiles re-projected arcpy.AddMessage(projectResult) ...
1
vote
1answer
52 views

Python - Projecting different shapefiles in the same folder

I have a few shapefiles in one folder with different coordinate systems but would like to use one of them as a template dataset. Is there a way to use python to filter out the shapefiles already in ...
1
vote
2answers
78 views

Using where clause to query date ranges in ArcPy

I would like to query a feature classes date range. For instance, if there is data within a 2 day range then I would like to print true or do something else. I thought arcpy.Exist would do the job, ...
1
vote
1answer
39 views

Set GPLinearUnit type parameter default based on input spatial reference (Buffer Example)

Within a .pyt python toolbox I'd like to have a parameter of data type GPLinearUnit get a default value based on an input Feature Class (FC). The standard Buffer (Analysis) tool works as a great ...
1
vote
1answer
45 views

Viewing pseudo node and dangle nodes using ArcPy?

We know that we require production mapping extension and ARCINFO license to view the pseude node and dangle nodes.We have to see these nodes without these functionality through python scripting,but I ...
1
vote
2answers
46 views

SaveToLayerFile does not properly save symbology

I'm trying to save a symbology from a layer, but any way I try to do it, it just gives me a unsymbolised feature shapefile when I try to add the newly created .lyr file. Anyone have any idea why this ...
1
vote
1answer
39 views

How do I enumerate the messages in arcpy.GetMessages()?

Messages are present in GetMessages() but it's a formatted string. I want to add some of my own newlines and alter the content on a per-message basis. How do I access the individual messages in ...
1
vote
2answers
37 views

Running Select results in error 000210

I'm trying to run SELECT in order to extract specific features under "CLASS_NAME", but continue getting "ERROR 000210: Cannot create output". I've searched though other questions with the same ...
1
vote
1answer
33 views

AddLayertoGroup

I've been using ArcGIS 10.0 to create arcpy scripts. Now that I'm using ArcGIS 10.2, I try to run those scripts in the new environment but I get some errors. One of them is the following one, that I ...
1
vote
1answer
69 views

arcpy.da.UpdateCursor - How to update last column from Field Name List?

examples: for field in arcpy.ListFields(fc): if field.name != 'Hi': arcpy.AddField_management(fc, 'Hi', 'FLOAT') else: print "kolona Hi vec postoji" with ...
1
vote
2answers
130 views

Cannot convert string to int using ArcPy Calculate Field

When I load a csv file to join with ArcPy, it converts all string fields that are numeric to integers. Therefore, I have to add another field within the feature class that I'm using for joining that ...
1
vote
1answer
57 views

ArcGIS geometry update from table XY

I am trying to update the geometry of a point FC stored in a FileGeodatabase using ArcPy. I got this Python script to compare the values of the SHAPE@X and SHAPE@Y and change the Geometry if not ...
1
vote
2answers
155 views

Why is my cursor empty?

Yesterday I set up a Python script using a cursor on a layer. Today I've tried running again and no matter what I run it in, the cursor is empty. I've tried removing the query on the layer, tried ...
1
vote
3answers
67 views

How to return a unique value from table using Arcpy?

Using Arcpy in Python, I would like to return / print '0.15' from the following table: When I use the following code I get "(u'D', 0.20)" as my print statement in Python: import arcpy fc = ...
1
vote
3answers
52 views

How do I create points in a Feature Class from a database table?

I have a destination (Feature Class): C:/Users/XXX/Documents/ArcGIS/ABC.gdb/SamplePoints I have a database table in the same file geodatabase that contains my source point data. I have columns with ...
1
vote
1answer
64 views

ArcPy Table to Table Conversion Not Working Correctly

I have a script which writes the lat/lng of a json web service of bus routes. The script writes the latitude and longitude to a CSV correctly. However my table to table conversion does not work ...
1
vote
1answer
116 views

Issue with using arcpy.GetParameter and arcpy.GetParameterAsText to write layer source to text file

I am trying to get a Map Document and (a new) text file as user defined parameters, in order to write to the text file a list of layer sources. The text file is then suppose to open once complete. ...
1
vote
2answers
140 views

Python scripting for feature classes (loop, sort, merge, and replace)

This is what I have to accomplish using a python script for ArcGIS 10.1: Loop through all feature classes and first add a field, then write the name of the feature class into the added field. Merge ...
1
vote
3answers
69 views

Move Incorrectly Placed Address Points to Correct Parcel

I'm currently in the process of cleaning up a municipality's address point data. I'm working with two data sets: address points and parcel polygons. Both the address point data and the parcel polygons ...
1
vote
2answers
76 views

Opening table from a geodatabase in Arcpy

I have tables in a geodatabase. I want to open and work with them in my script. The first step I appear to have to do is scripted underneath. My result of this script is all names of all tables in my ...
1
vote
1answer
71 views

Extent to xy coordinate- arcpy

I work with arcview 10.3, and i try to extent to xy coordinate with arcpy? I am using this code: import arcpy, os, sys from arcpy import env env.workspace = r"C:\Project" pnt = '178434 ,662446' ...
1
vote
1answer
19 views

The updateCursor doesn't update all the cells in the shp, just some of them

Dont know for sure what is happening, but when i use arcpy.UpdateCursor it only write some of the lines not all the lines. The code is: cursor = arcpy.UpdateCursor("FInal1a1.shp") for row in cursor: ...
1
vote
1answer
146 views

Updating row in list of feature classes using dictionary in Python?

I have a list of feature classes (fcList) that I would like to do the following. - add a field (fire_dis) - update row from a single value from a dictionary(fcnaDict) - more specifically I am ...
1
vote
2answers
170 views

Calculate Date field in ArcPy

I'm trying to use arcpy.ExtractValuesToPoints() to get raster values to a points feature class for several raster files (8760). The goal is to get a time-slice view of how the values at certain ...
1
vote
1answer
90 views

Run a custom model via ArcPy fails

I'm trying to geocode a few address using a custom model created. When running the model via model builder all runs perfectly. Also when running it via the embedded interactive python console in ...