Questions tagged [arcpy]

A site-package created by Esri to expose ArcGIS Desktop (ArcMap and ArcGIS Pro) geoprocessing, mapping, etc, to Python.

Filter by
Sorted by
Tagged with
0
votes
2answers
44 views

Iteratively Filling a Dictionary and Updating a Feature Class

import arcpy fiberCable = r'C:\Users\broadhurstn\Documents\ArcGIS\Default.gdb\FIBERCABLE' fibercableToConduit = r'C:\Users\broadhurstn\Documents\ArcGIS\Default.gdb\FibercableToConduit' conduit = r'C:\...
2
votes
1answer
25 views

Updating field in geodatabase table depending on other field using ArcPy?

I have a table in a file geodatabase that has "FieldA" and "FieldB". I want to update FieldB with one of two values, depending on if there are one or more records with the same value of FieldA. ...
4
votes
2answers
210 views

arcpy.GetParameterAsText not passing arguments to script?

I have been working on an ArcGIS Python script tool which takes the co-ordinate system from an input raster and reprojects a vector to the same co-ordinate system. The script works fine when i hard ...
0
votes
0answers
29 views

Exporting selected features using ArcPy?

# Wetlands buffer.py # Description: Program that determines if Wetlands are within 0.5 miles of specific point files with the program returning a 'yes' or 'no' if a wetland is within the range or not. ...
1
vote
1answer
68 views

Converting Python script from ModelBuilder?

I ran the ModelBuilder to Python script and now my script won't run. It has a problem with the local variables. Is there a fast way to declare all the variables even though some of them are created ...
0
votes
1answer
59 views

Batch exporting individual MXDs to individual PDF files using ArcGIS Desktop?

I need to pdf several mxds into their individual pdfs and am hoping there is a quicker way to accomplish that other than opening each file individually and exporting individually. Data Driven Pages is ...
1
vote
2answers
63 views

Installing GDAL on an ArcGIS machine?

I have ArcGIS Pro (2.3.x) installed on my PC. I have python scripts which call ArcGIS toolbox models and runs them. Everything works fine. Today I installed GDAL and Python bindings for GDAL. I also ...
0
votes
1answer
45 views

ERROR ArcPY parsing error SyntaxError: invalid syntax (line 2)

I'm trying to convert multiple lines to points so I typed the code bellow but it keeps on showing me this error: Parsing error SyntaxError: invalid syntax (line 2) liste_ligne =["E1_H20A_H35_D21E",...
1
vote
2answers
48 views

Python upload to service fails in FME but works in ArcGIS

I have added a shutdown Python script to my FME workbench to publish the TIFFs written as a service. import fme import arcpy AGSconnection = "W:\\Entity\\ABZ\\myfolderpath\\gbepabz-file.name.ags" ...
1
vote
0answers
28 views

Performance degradation in arcpy.mapping when setting text elements

I'm generating a map book of about 300 pages using arcpy, instead of using the toolbox, because I need to do a bunch of scripted actions - on each page I'm setting the extent and rotation of 3 ...
0
votes
1answer
49 views

Fetching data from ArcGIS attribute tables using ArcPy? [closed]

I want to fetch/extract data from ArcGIS attribute tables (to set some temporal series) using Python. Because of the structure of my tables and their disposition, I thought of using the "division" ...
2
votes
2answers
50 views

Opening different XLS spreadsheets as table with ArcPy?

I am trying to write a Python script that uses a xls file with different spreadsheets as input to build features and domains in a geodatabase. This is the data in Sheet1: and this the data in ...
1
vote
0answers
42 views

Cannot set input into parameter error on second iteration

On the second iteration of the loop starting line 7 I get the following error. Everything works as intended on the first iteration. Any ideas on why this is failing the second time around? Error: ...
1
vote
0answers
50 views

Setting color assignment order with ArcPy?

I have a shapefile feature class with the following attribute table: I set the shapefile symbology using these lines: lyr.symbology.valueField = "GRIDCODE" lyr.symbology.addAllValues() What i get ...
1
vote
0answers
30 views

Error 000445 in iterate Resample for rasters in Arcpy

I'm trying to resample rasters using a foor loop. Something is going wrong but i don't know what... This is my code: import arcpy, os, math from arcpy import env from os.path import split, join from ...
0
votes
2answers
46 views

Automate Access to all Tools in a Dynamic Toolbox in ArcMap?

Is there any way to automatically open a toolbox in ArcMap either from a model, a Python script or a Python Add-In, or similar? Or to otherwise make all of the tools in a toolbox easy to access for ...
1
vote
1answer
34 views

How to select lines closest to another set of lines?

In the image shown above, I am trying to select lines marked in green color that are closest to the blue lines along the direction of the blue lines. I did a lot of Google searches, but I could not ...
1
vote
1answer
37 views

Access layer of raster stored in memory using ArcPy to create NDVI from subset of multi-band raster

I am trying to create a final output of an NDVI raster for a number of Landsat images run through a for loop in Python 3 (for ArcGIS Pro). I am able to produce the NDVI rasters when I save the ...
0
votes
0answers
29 views

ArcGIS Map export fails with when using scaleDependentRenderer

I am using ArcGIS javascript API 3.11 so as to call a map export service (printTask). This used to work fine, until I decided to print a graphics layer with a scaleDependentRenderer. The ...
1
vote
0answers
36 views

Writing value into specific column in ArcGIS table? [closed]

I am writing a Python script to add fields and write data into the ArcGIS table. I can successfully edit and delete columns or fields in the table. But I am stuck at writing data into the fields. I ...
0
votes
0answers
32 views

Raster data project

I have a raster data which has been subdataset with no projection on it. I am trying to define the projection, however it doesn't work with me. I used arcpy.ExtractSubDataset_management to extract ...
0
votes
1answer
27 views

“Does not exist” error when loop through directory

I need to write a script that loops through shapefiles in a folder and adds fields to each shp. It works for one file at a time, but the added for loop go through the folder is throwing an error that ...
1
vote
2answers
48 views

If statement not moving to else: when false?

I am looping through 2 sets of rasters to do a extract by mask of one raster using the other, with ArcPy. However, if the mask raster does not exist I want to skip to the next set of rasters. Both ...
0
votes
1answer
73 views

Calculating Terrain Roughness Index using ArcGIS Pro?

I am trying to calculate Terrain Roughness Index (TRI) as written up in Riley et al 1999, and have used the python code located here. However, this approach converts a raster to a numpy array and then ...
1
vote
0answers
26 views

Densifying many shapes at same time using ArcPy? [closed]

I have all these shapes to densify I thought it will be better if I code with ArcPy in order to densify all the shapes once at a time. So I thought of this code: #creat the list of shapes to ...
1
vote
0answers
24 views

GTFS network dataset not working with ArcPy? [closed]

I prepared a GTFS network dataset for Sydney following guidelines of Add GTFS to a Network Dataset tool. I setup a multiprocessing python script which is working perfectly fine with 64-bit Python in ...
1
vote
1answer
113 views

How to delete temporal files from geoprocess tools using Python ArcPy?, ArcMap10, ArcGis

As is not possible formulate, or add a solution to question: Delete temporary files from geoprocessing in ArcGIS 10 and above , because is [closed] I would like to make this question with same ...
2
votes
1answer
42 views

Getting layer label from ArcMap Table Of Contents?

How do I get a layer´s label from the TOC? I can´t find a similar question and ArcGIS Help tells nothing about it. I have searched even in other knowledge bases but with no success. I need to get ...
2
votes
1answer
29 views

How to get the source name of a feature layer

I have feature layers that have a different name in the TOC then that they do in the GDB. I cannot change either of these and I need the name of the feature class from the GDB in order to make my ...
0
votes
1answer
25 views

Create XY Event Layer using Python Script tool

I am trying to create a script toool for Making XY Event layer , But having stuck with GetParameters function while running the script with an error window of "This tool has no parameters" Here is my ...
0
votes
0answers
16 views

How to join the Least Cost Path with Optimal Destination?

I have the following problem which can be solved in 2 stages: The first stage is to calculate the least cost path for transporting the produce from a pixel on the field to the edge of the road, for ...
1
vote
0answers
17 views

ArcGIS Pro Unable to Pairwise Intersect Point with Polygon?

I am trying to create a point from XY coordinates then use Pairwise Intersect to determine the corresponding parcel. The intersect is not returning any values. Any thoughts on the error in this code? ...
1
vote
0answers
27 views

Using ETGeoWizard functions in ArcPy?

I have ETGeo Wizard license and I would like to run the functions via ArcPy instead of running them in ArcMap. However, the functions works in ArcMap but not in a script. one of the example is ...
0
votes
1answer
36 views

Is it possible to delete ArcGIS imageserver using a script?

I have an app that allows users to upload TIFF files so that an ImageServer is created in ArcGIS 10.5 Server. However, I don't want to keep the images over a day. Is there a way of automatically ...
1
vote
1answer
27 views

Image service uploaded using ArcPy has no statistics?

I am trying to publish an image as a service using python in ArcGIS 10.5. Everything works except that the published imageserver has no statistics especially minimum and maximum. However, imageserver ...
0
votes
1answer
46 views

Iterating over feature class and performing select by location using each feature as Selecting Features in ArcPy for ArcGIS Pro?

I have a polygon feature class which contains many (9952) polygons, some of which overlap each other. I have another point feature class with many points (15998) and one of the fields is called ...
0
votes
1answer
51 views

Converting script for replacing layers of MXDs into tool?

I have a script that runs correctly form the command prompt. But when I try to get user input for folders and an MXD, it doesn't run. The script is as below. How can I convert this into a working ...
1
vote
1answer
39 views

Resample raster to a higher resolution with ArcPy

I am looking for a way to upsample a raster to a higher resolution without interpolating in ArcGIS and arcpy (because I have geoprocessing script which treats a lot of rasters). For example if I ...
2
votes
1answer
48 views

Error in ArcGIS Pro when Adding Layer to Group through ArcPy

I'm trying to add layers to an empty group layer through arcpy in ArcGIS Pro. I've read that creating empty group layers only works by importing a saved template. I'm able to load my template and it ...
1
vote
1answer
25 views

How do I open / move the focus to a layout in ArcGIS Pro using Python?

I have an ArcGIS Pro project which contains multiple layouts. I've got a Python toolbox with a script which, among other things, chooses which of the layouts is appropriate for a specific map. At ...
0
votes
2answers
43 views

Reprojecting a GDB in arcpy

I am trying to convert the feature classes in data.gdb to a new PCS per the code on this webpage: import arcpy import os arcpy.env.workspace = "G:/W135thStCopy/data.gdb" arcpy.env.overwriteOutput = ...
1
vote
1answer
41 views

ArcPy Add Locations tool & sublayers

I run ArcGIS 10.6.1. I am currently doing a network analysis but run into the problem where I can't relate the error I get to what I want to do. My code looks like this: XMLPath="C:\\Work\\...
2
votes
1answer
92 views

Using ArcPy FieldMappings?

This is a follow up to Output field name not showing up in spatial join result in which I received no response. I am trying to convert a shapefile to a feature class, I also have a GeoJSON file with ...
0
votes
2answers
166 views

Testing if os.path.exists with ArcPy?

I am having trouble getting the os.path.exists to recognize that a file exists. I keep getting "File does not exist". I reduced the code to the absolute necessary to address my question. I believe ...
0
votes
1answer
49 views

Using geometries to extract line segments in ArcPy with ArcGIS Pro?

I'm trying to use geometries to cut down a feature class of polylines to just the first 400m of each polyline. I modified an answer from Split a shapefile of lines into even spaced segments and am ...
1
vote
2answers
74 views

Using Select by Attribute within a for loop

I am trying to iterate through a feature layer of counties, using each row as the selection expression for Select by Attribute. This selection will then be used to clip another layer. The goal is to ...
0
votes
0answers
12 views

Using ConvertToMSD in ArcPy to report an error

I have two questions: 1. Is the mxd file generated by arcgis10.4 not converted to msd file by this method? 2. If can, my code is like this import arcpy mxdPath = "F:/mm.mxd" msdPath = "F:/test.msd" ...
4
votes
1answer
108 views

Getting and editing list of strings from file geodatabase

I have a file GDB that contains Annotation and Polygon feature classes. I would like to create a list of strings with the first part of the name of the polygon features. For example in the data below ...
0
votes
0answers
100 views

Why is internal memory not overwritten?

I have the following code in Python for ArcMap to first select a property polygon and then with this selection to intersect the layer which contains lines (sewers) (which pass through or are within ...
2
votes
1answer
37 views

Updating arcpy.Array() syntax from Python 2.7 to 3.6.6 for ArcGIS Pro 2.3?

I was working through an exercise designed to teach basic Python skills in ArcMap using Python 2.7. The file below consists of 34 pairs of x,y coordinates. The script creates a new empty polyline ...