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

learn more… | top users | synonyms (7)

0
votes
1answer
31 views

Run standalone python script against mxd, not outputting layer file/package

The bulk of the code used in my script for reading this is from @RHB located here. His block of code runs fine with a current map open. Need it to open without an ArcMap session open. I tried as ...
1
vote
1answer
49 views

ArcGIS Focal Statistics Returns Out-of-Bounds Result

I am trying to compute a moving window maximum on a raster, such that the output is the max within a 5 mile radius. This should result in an output grid where the maximum is equal to the maximum of ...
2
votes
1answer
41 views

Field Calculator is not calculating selection from Make Feature Layer in arcpy

I am trying to use field calculator to calculate 3 different fields in python from a Make Feature Layer variable. It calculates the first field (MATERIAL_T) but then it doesn't calculate the second ...
1
vote
1answer
34 views

Export footprints of an unmanaged raster catalog with arcpy

Is there a way to access the "export footprints" function for an unmanaged raster catalog with arcpy? It can be done through ArcMap when a raster catalog is added to the map as seen below. The ...
0
votes
1answer
40 views

Converting geodatabase public lands to a shapefile

Can a whole geodatabase be converted to a single shapefile? This is my code, not sure what I am doing wrong... # Import system modules import arcpy # Set environment settings arcpy.env.workspace = ...
0
votes
0answers
42 views

ArcGIS: What is the behavior of ToolValidator class and checkboxes?

In trying to simulate a pair of radio buttons in a ToolValidator class using checkbox parameters (yes, this subject has been discussed before), I find that I do not understand what exactly is the ...
1
vote
1answer
49 views

How to find the sum of many raster files in arcmap?

I have a list of 576 raster files for which I need to find the SUM. Obviously using raster calculator one by one would be tedious. Any easy script in Arcpy to do this?
0
votes
1answer
17 views

ArcGIS Calculate Near by looping through and matching .shp names from two different directories

I have several thousand shapefiles in one directory (direct1) and several thousand other shapefiles in another directory (direct2). The files in direct2 will have a match in direct1 and will have the ...
2
votes
0answers
66 views

Select by location not selecting all features in ArcPy [duplicate]

I am having an issue with the "select layer by location" tool in my ArcPy script, that may be due to a hidden memory error. Using one feature class with 281 polygons, I would like to select all of the ...
1
vote
1answer
44 views

Graph preview in Python toolbox

I need to create a toolbox in python, which will be used for making graphs. I need the parallel preview window during the graph creation. Half of the screen will be used for settings the parameters ...
1
vote
1answer
52 views

Calculating centroids without adding field to table using ArcPy?

I haven't been able to find any bit of code that does this successfully. I need to delete some fields in a table that I'm modifying using a script I'm writing. I don't want the fields to be left on ...
3
votes
1answer
51 views

ArcPy SearchCursor row format

I set up a script to print some statistics about line segments. The "logfile" is basically the same as "print", but to a textfile instead of on screen only. LogFile("Feature {0} has a length of ...
3
votes
0answers
29 views

Mask out values in a raster based on standard deviation

Does anyone know (in Modelbuilder or python) how I can remove any values of a raster that outside of the range of three standard deviations? I have a lot of rasters so it would be quicker than ...
2
votes
1answer
88 views

arcpy.UpdateCursor updates every row

I would like to update a field with new values. With the code below it assigns the value '2' to all the rows and not just if the field == 2. But by 'print i' and 'print "it is 2"' everything looks ...
3
votes
0answers
20 views

How to get rid of layer created by Make Feature Layer (Data Management) [duplicate]

I like to run some scripts from mxd. Very often I am using Make Feature Layer tool to facilitate queries. Tool help says: “Creates a feature layer from an input feature class or layer file. The layer ...
3
votes
3answers
216 views

Can a feature class be stored as a shapefile?

This is a general question about how a feature class is stored or can be stored using python/arcpy. Can a list of created points (a feature class) be saved as a shapefile or in a shapefile, or to ...
1
vote
0answers
58 views

Replicate elevation profile extraction (from 3D Analyst toolbar) with Python [closed]

I'm looking to take Python (v2.6.0) control of some ArcGIS (v10.3) toolbar functions in 3D analyst, so I can modify and automate these operations. If the answer is that I need to do this from scratch, ...
5
votes
1answer
128 views

UpdateCursor gives Too few parameters Expected 1?

Can anyone tell me why my script isnt working? I cant figure out where I went wrong. I am working with an access personal geodatabase. Adding a field, then updating that field with yes if the field ...
1
vote
2answers
82 views

Updating firstPoint and lastPoint using ArcPy cursor?

I want to update a Line feature's start and end. I got Point of first and last. BUt, I can't update them. What is wrong ? (I'm using ArcGIS 10.2) rows = arcpy.UpdateCursor(srcFile) feat = ...
1
vote
0answers
58 views

Looping spatial join in arcpy - order problems

I developed a python script where the user inputs a polygon shapefile multiple point shapefiles and within the script the polygon shapefile is divided into 1000mx1000m grid cells and the point ...
1
vote
1answer
56 views

ArcPy: Geoprocessing for the data with specific variable [closed]

Imagine if we have dataset like this: +------+------------+ | City | DistrictID | +------+------------+ | A | 001 | +------+------------+ | B | 001 | +------+------------+ | C ...
1
vote
1answer
29 views

Value Table in Python Script not displayed correctly?

I am trying to implement a Python Script tool where I need a table to input shapefiles and corresponding names for new created fields. I found out that there is the Value Table provided by ArcGIS, ...
4
votes
2answers
89 views

Python script that creates polygon feature class with given coordinates

Write a script that creates a new polygon feature class containing a single ( square ) polygon with the following coordinates: ( 0, 0 ), ( 0, 1,000 ), ( 1,000, 0 ), and ( 1,000, 1,000 ). ...
2
votes
1answer
64 views

arcpy.Clip_management throws 999999 error. Running from toolbox works fine

I want to clip multiple rasters to my study area, so I'm writing a script that's using the arcpy.Clip_management tool. However, the tool throws an 999999 error with no explanation when executing. I ...
4
votes
1answer
40 views

Using findAndReplaceWorkspacePaths to change picture path element- ArcPy

Picture element, in 60 MXD files, disappear and there only blanked rectangle instead. I know one way to solved it, by go to the picture properties-->picture tab. But i try to find a way do it with ...
3
votes
1answer
37 views

Using findAndReplaceWorkspacePaths to change datasource for CAD files- ArcPy

I try to use "findAndReplaceWorkspacePaths" in order to change datasource for CAD files. This code works fine but when there no cad layers to work with, despite this the code will print ...
1
vote
0answers
23 views

Can't display raster in mxd as RGB

I have a script that iterates through a folder of jpgs, clips them to a grid, inserts them to an mxd, and exports them. My original problem was when I added the clipped raster from a standalone script ...
1
vote
1answer
102 views

How to iterate through layers of an MXD?

I know model builder will not iterate through the layers in an MXD, which is kind of fundamentally stupid if you ask me, but I still need to do exactly that. I am not a strong coder but i understand ...
0
votes
1answer
57 views

Measure Point Along a Line

Looking to find Distance along a line(road) by a user input(Mouse Click). Here is my python code TESTED and works def onMouseDownMap(self, x, y, button, shift): mxd = ...
0
votes
1answer
97 views

Route Layer with ArcPy and OSM Data - very slow

This is my first attempt at using arcpy: I have two CSVs which have columns: CSV1: join|id_a|lat_a|lon_a CSV2: join|id_b|lat_b|lon_b Each has got 100 rows of data. I would like to write a script ...
3
votes
0answers
57 views

Iteration from a text file [closed]

Trying to determine logic to create a line from the points for each Line_X number Example: Create array of points, then a polyline for all points of Line_1, then Line_2, etc. pointList = ...
1
vote
2answers
151 views

Determine rasters particular area's within ranges using python

My directions: Create a script that determines what areas meet the following conditions: Moderate slope — between 5 and 20 degrees Southerly aspect — between 150 and 270 degrees Forested — land ...
3
votes
1answer
19 views

MakeXYEvent setting values in CSV with numbers as text in result?

I thought I had a working ETL script going that was writing a CSV from a non-spatial Oracle DB to ArcGIS gdb when one day it broke. I whittled it down to the MakeXYEventLayer process. Basically I ...
0
votes
0answers
37 views

Batch Clipping Shapefiles using Argparse

Is there a way to batch clip shapefiles in ArcPy using an argument-Argparse (which calls a shapfile or group of shapefiles) specified by an outside user in command line?
0
votes
0answers
39 views

Execute Built-In Command in ArcMap using Python Add-Ins Extension Event?

Is it possible to execute an ArcMap built-in command programmatically, using the Python Add-ins framework? Can ArcMap built-in commands be exposed to and executed using the event methods found in ...
2
votes
1answer
74 views

Repoint feature layers from one SDE to another

I am trying to repoint layer (.lyr) files to a new SDE connection. In a test project folder I have two test layer files. When using lyr.findAndReplaceWorkspacePath() the script runs with no errors, ...
0
votes
0answers
59 views

Spatial Join - Field mapping to delete and rename fields

I have a python script where the user can enter a study area (Polygon shapefile) and multiple point Features of interest (Point shapefiles). The point shapefiles are looped through and joined with ...
1
vote
1answer
88 views

How do I load a .shp file using a button with ArcPy?

I have created a python addin where the user should be able to select a shapfile and then load, but I've not been able to put in the current workspace. import arcpy import pythonaddins import os from ...
2
votes
1answer
105 views

Creating composite band mosaic of sentinel 2 data with arcpy

I previously useda simple script that went through many Landsat satellite images, and for each folder it found it made a composite band raster. The script was as follows: import arcpy import os ...
1
vote
1answer
47 views

Spatial join for multiple shapefiles (loop)

I have the following two datasets: polygon shapefile containing administrative boundaries of a City multiple point shapefiles What I want to do is to spatially join the point shapefiles with the ...
-1
votes
1answer
47 views

Creating a Map Outside of ArcGIS Environment in Python

How would you create a batch of maps in Python from shapefiles that the user specifies and implement features (preferably user specified) used in 'Layout' view in ArcGIS such as adding legends, ...
1
vote
1answer
69 views

deleting Broken Source from arcgis toc with python addin

i have created one python addin tool. which create some layers in Memory. at the end of the script it deletes the In memory layer. but such layer still remains in TOC with a broken link how can i ...
3
votes
0answers
72 views

ArcGis' python library (arcpy) are imported so long

python -c import time; t1 = time.clock(); import arcpy; print('{0} seconds'.format(time.clock() - t1)) 3.60283379862 seconds It takes this long each time i launch my script or test. Is there any ...
3
votes
1answer
27 views

Change map element order in ArcPy

I am trying to change the order of text elements through arcpy, such as sending them to the front or to the back. I know I can change the position of text elements using arcpy, but I can't find any ...
2
votes
0answers
68 views

Output from geoprocessing service

I am using ArcMap 10.3.1. I have created a custom tool using a python script, the code for which is listed below, that uses a lookup table to reclassify vector data. When run on the local machine the ...
2
votes
0answers
13 views

Problem Importing CAD features using arcpy.MakeFeatureLayer_management?

When importing multiple CAD drawings using "arcpy.MakeFeatureLayer_management" and "arcpy.Merge_management" I encountered a problem. Drawings that have line weights and elevation values assigned to ...
0
votes
0answers
25 views

Arcpy.mapping.MoveLayer can't find the RefLayer [duplicate]

I've tried this several ways and don't know why ArcMap won't find the ref layer. Here is a code snippet. import arcpy if lyr is not None: del lyr #Add constants mxd = ...
3
votes
1answer
34 views

Is there any way to capture ArcMap Drawing Errors inside of a python script?

Is there any way to capture ArcMap Drawing Errors inside of a python script? Through python, I would like to iterate through each layer inside of an MXD, make the layer visible, refresh the table of ...
5
votes
1answer
69 views

Writing points to a file

Trying to write the city name and point coords to a file. The following works with a polygon shapefile but not the point shapefile. I know I'm missing something basic. import arcpy # Set up the ...
2
votes
2answers
98 views

PackageLayer_management failing within script, needs to run outside of an ArcMap session

I'm automating a workflow that requires outputting a layer package, it throws the general ERROR 999999 when executing and breaks. It does, however, generate a folder in the correct directory, with ...