A site-package created by Esri to expose GeoProcessing from ArcGIS to Python.

learn more… | top users | synonyms (7)

1
vote
0answers
92 views

Defining spatial reference for multiple raster files [closed]

How do I define the spatial reference for a bunch of *.JP2 files? import arcpy from arcpy import env arcpy.env.workspace = "C:/Ortho" lrs = arcpy.ListRasters("*","JP2") for rs in lrs: print '...
1
vote
1answer
150 views

How to check in Python if a model has been successfully executed from a toolbox?

I have created a Toolbox (alias: mytool) and a model (name: mymodel; and it takes 2 parameters which are 'this' and 'that') with ModelBuilder. I need to execute this model from a Python script. arcpy....
0
votes
1answer
68 views

Code error - remove layer using python

Continuously to How to remove layers that are not in visible df extent i try to remove layers that don't appear in the data frame with this code: import arcpy,os from arcpy import env env.workspace =...
0
votes
1answer
94 views

'Result' object has no attribute 'GetMessage', ArcGIS Example

i'm using the following ArcGIS example to calculate the surface and volume of a raster. I added the script to my toolbox: '''***************************************************************************...
1
vote
1answer
112 views

Making lookup table for performing Lookup(inRaster, lookupField)?

I want to replace the Digital number (DN) values in a raster file with some other values which are present in a text file;in the text file, I have a table which it's first column are all possible DN ...
0
votes
1answer
83 views

Creating new layer from selection in ArcPy? [closed]

arcpy.SelectLayerByAttribute_management() helps in selection but I am unable to create a new layer from the selection arcpy.MakeFeatureLayer_management() for generating new layer file but it gives an ...
1
vote
0answers
55 views

Changing label symbology in ArcPy?

I'm trying to change the default symbol (font, halo etc) for labels of a layer that I am adding to an mxd. Below is what I have so far, but the template layer font style didn't show up in the map. ...
2
votes
4answers
98 views

IF else statements arcmap, using python

I have a shapefile with a number of fields. I have one field (let's call it Field A) that I need to populate based on another field (let's call it Field B). If Field B is greater then 0 I need it ...
1
vote
1answer
56 views

Problem adding feature name to field in attribute table

I have a small script that should take the name of the file and add it to a newly created field in several shapefiles. import arcpy arcpy.env.workspace = r"c:\users\athom\desktop\timber\New4" ...
3
votes
1answer
95 views

Using ArcPy to export individual mxds from data driven pages?

I'm trying to generate individual mxds for each page in my data driven pages (which I have set up already). I have 38 pages in total, so I would need to generate 38 mxds. The pages are named according ...
3
votes
0answers
39 views

Why does my Validation Script continue to run when adding the result to the map?

I am in the process of developing a python script that creates a list available imagery for our project areas that would then allow the user to choose which imagery source they would like to add to a ...
1
vote
1answer
455 views

Arcpy getCount_Management doesn't match row count with Cursor

I have some troubles to understand the behaviour of my code below. Obviously, GetCount_Management doesn't match the rows in my layer selection. This code is part of a long for loop. I have hidden the ...
2
votes
3answers
172 views

How to calculate Statistics of an attribute field to use it in another calculation

I want the statistics of an attribute field to use in another calculation, i can view the statistics using the field properties menu I want these to normalised the data of field 'Ia' using the ...
1
vote
1answer
74 views

How can I create custom projected coordinate system in arcpy?

I want to create my own projected coordinate system based on one of geographical coordinate systems and set custom values to properties as longitude, scaleFactor etc. I found SpatialReference class. ...
0
votes
0answers
18 views

How to ApplySymbologyFromLayer but autogenerate unique color?

I am trying to write a script that will allow me to change all the layers within a selected group layer to a particular symbology. For example, we often want to change our point data to all display ...
0
votes
1answer
147 views

Using python and ArcPy to read multiple files, apply a function and write into new a directry

I haven't used python yet; I want to read multiple GeoTiff files and resample them based on another single file, and be able to write all the files in a new directory. I can use R raster package to ...
1
vote
1answer
63 views

Problem replicating ArcGIS Grouping Analysis 'grouping effectiveness' statistic results

I posted this question over on Esri's GeoNet, but have not yet gotten an answer. Using ArcGIS v10.2.1, I have been using the Grouping Analysis tool to generate a range of clusters from my data. I ...
2
votes
1answer
39 views

Calculating the area of groups based on intersect of several shapefiles using ArcPy?

I have 5 shapefiles. There are 72 possible groups of 'land cover+top-rock+subrock+soil drainge' in each watershed. I want to get the area of the different groups of 'land cover+top-rock+subrock+soil ...
1
vote
1answer
23 views

Create Separate Layers by Category

I'm trying to create a layer for each county (based on a layer of all counties) and join only those census tracts located in that county. However, the result I'm getting is a layer named for each ...
0
votes
1answer
60 views

Arcpy - (Error 999999) Table Already Exists Project Management

My code is supposed to clip features within a temporary directory, project them and place them into a specific feature dataset within a geodatabase. Then the code goes back and deletes the temporary ...
4
votes
1answer
106 views

Importing MXD to ArcGIS Pro programmatically?

I have a problem with importing an MXD file to ArcGIS Pro programatically. I try to do this by using the following arcpy.mp code: import arcpy aprx = arcpy.mp.ArcGISProject(r"C:\test\blank.aprx") ...
0
votes
0answers
72 views

Same script runs in python window fails in script tool

I have this snipplet, in which I'm triing to use. If I run it in the python window in ArcMap it runs correctly, but when I'm using it as a script tool, it fails without error message. This script ...
0
votes
1answer
44 views

How to show 100K results of a complex query on map without using graphics

I need to show all 100K points on the map without using any sort of clustering. Since they are too much they cannot be shown using a graphics layer. since they are result of a very complex Oracle text ...
0
votes
1answer
145 views

Using search cursor with ArcPy and Spyder?

I recently installed ArcGIS 10.3.1 (previously had 10.1 installed) and I am trying to run a script in Spyder 2.7 that has always worked and getting the below error: "Traceback (most recent call last)...
0
votes
1answer
89 views

Using function in SQL query with ArcPy?

I am trying to join points to polygons based on whether their addresses match as well as if the distance between them is less than 2500 feet. I defined a haversine function that computes the distance ...
1
vote
1answer
39 views

Empty feature classes made when trying to split by attribute

I am working with a Basic license of ArcMap 10.3, and I am trying to split a feature class into multiple feature classes in a geodatabase by unique values of an attribute. More specifically, I have a ...
1
vote
1answer
46 views

Installing Pythonwin for use with ArcPy?

I have ArcGIS 10.0 And installed pythonwin 2.6.5 When wrote a script in Python Shell - it works just fine But in pythonwin - i get import arcpy error as below >>> import arcpy Traceback (...
2
votes
1answer
109 views

Select Data won't work… Parameters are not valid in ArcGIS ModelBuilder?

I'm creating a model in the ArcGIS 10.3 ModelBuilder and have problems to get the select data tool to work. At first the complete model: IHS-Klassifizierung With the Select Data tool (Input Data ...
1
vote
1answer
119 views

Using arcpy to create a layer from business analyst dataset

I'm trying to automate several of our processes using Python in ArcGIS for Desktop 10.3. At least one of these tasks involves running a query against block group data provided by Business Analyst (BA)....
2
votes
0answers
100 views

How to speed up my script? [closed]

I am looking for the way to speed up my script. It is working fine, I mean, the final output is as required, but it is clunky and really slow. It is slow because of the double 'for..in..' loops, I ...
0
votes
0answers
10 views

Using predefined variables in whereclause? [duplicate]

Can't seem to figure out how to use variables for an SQL whereclause in python. e.g. want to select_analysis(layer, "new sel", field = attribute) with field and attribute being predefined by user ...
0
votes
0answers
36 views

Using Calculate Value tool in ModelBuilder to ignore/skip rasters without features/data? [duplicate]

I'm trying to use the calculate tool to skip rasters in a model. I don't know very much python and can not fix the errors I encounter. When the model runs rasters will be run through a raster ...
1
vote
1answer
102 views

arcpy and ArcGIS Pro: update Z values of a pointMZ geometry

I am trying to "reverse" the values of Z in a pointMZ geometry with arcpy.da.UpdateCursor. Anyway, I am not able to find a way to achieve this, although my script seems to work (no errors, printing ...
1
vote
1answer
222 views

Open popup dialog window on button click in Python AddIn?

I'm trying to figure out a way to display an image in a dialog box that will be used for a help menu for my toolbar addins. The best scenario i've found is using the pythonaddins module and the ...
0
votes
2answers
116 views

How to get the specified point coordinates of a Polyline

lines_cursor = arcpy.da.UpdateCursor(lines,["From_id","To_id","SHAPE@"]) for lines_row in lines_cursor: from_id = lines_row[0] to_id = lines_row[1] if from_id in points_dict.keys(): ...
0
votes
1answer
71 views

Add mxd path to csv by Python

I'm trying to write a python script that adds to a csv file the date, time and mxd path. I tried to run the script from the Python IDLE without the mxd path and I succeeded to add the date and the ...
1
vote
1answer
104 views

Export PDF from a folder having multiple single mxd and mxd's having data driven pages

I have folder having multiple single mxd and mxd's having data driven pages. I am trying to get the pdf's of each of these MXD's.if mxd's has a data driven pages then all the pages from a same mxd ...
0
votes
0answers
12 views

Converting RGB values from CSV to ArcMap Save As Layer File? [duplicate]

I would like to Convert RGB values from a CSV to a ArcMAP save as a layer file. I have a csv file with 4 columns. First column shows Depth in feet and second, third, Fourth column shows that RGB ...
2
votes
1answer
52 views

Trying to understand updateCursor() for python

I am using ArcMap 10.2.2. I am attempting to write a script that will cycle through the classes in a database and change the attribution of 1 row. Is my variable "lyr" being recognized as the classes ...
1
vote
1answer
85 views

Selecting group layer using arcpy.GetParameterAsText()?

I have a script that allows me apply a single SQL Definition Query to all feature classes within a particular Group Layer. For ease of input for others in the office, I changed this into a model tool,...
0
votes
1answer
73 views

Adding file geodatabases as group layers?

I have a couple hundred file geodatabases (GDBs) each containing several feature classes. Is there a way for me to move the GDBs into an mxd such that each GDB is imported as a group layer ...
1
vote
1answer
233 views

Increase python script speed [closed]

for row1 in cursor1: if row1[0] != None: num3=row1[0].upper() custx=row1[4] custy=row1[5] num2=row1[8] try: m=re.search(r"^[0-9]+(?=\s)",row1[...
0
votes
1answer
28 views

Where Clause looking at two Columns and a RANGE Expression

Using ArcPy I'm Trying to Set up a Where Clause with a RANGE in my "FeatureClassToFeatureClass_conversion" This {Where Clause} needs to Query Two Columns in the data: FEATURE = 'ENVIRONMENT' and ...
0
votes
2answers
88 views

Drawing map from XY coordinates in CSV and exporting it to JPEG using ArcPy?

I have a csv file containing about 40,000 rows of data with X, Y (longitude and latitude) data. It is US data, and I have downloaded a state.shp file on which the X, Y points can overlay. I am able ...
1
vote
2answers
102 views

Alternative to nested Con statements in python

I have a nested con statement that I'd like to put into a script, as it's hard to follow in its current form. The raster it produces is incorrect, so it'd be easier to debug in a script. The ...
0
votes
1answer
198 views

How to set parameter dependencies in ArcGIS python toolboxes

I'm trying to build a python-toolbox where the user selects a layer and then specifies a column in that layer. According to the documentation, that is done via the parameterDependencies attribute of ...
0
votes
1answer
123 views

Copying content from one Portal for ArcGIS to another using Python?

I am trying to copy content from one portal to another with python only, without using AGO assistant https://ago-assistant.esri.com/, as this doesn't work behind our firewall in our test network. I ...
0
votes
1answer
22 views

Divide broken line layer in seperate clusters based on location

Building on a earlier asked question on this forum I would like to ask an additional question in getting the task done I asked here: Divide polyline layer in clusters with specific requirements in ...
1
vote
1answer
28 views

Querying two Separate Columns in ArcPy SQL {where clause}? [duplicate]

Using ArcPy I'm Trying to Set up a Where Clause in my "FeatureClassToFeatureClass_conversion" This {Where Clause} needs to Query Two Columns in the data: FEATURE = 'ENVIRONMENT' and TEMPERATURE &...