Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [arcpy]

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

0
votes
1answer
28 views

Trying to use a SelectByAttribute_mangement after I made the XY Event layer

I imported a CSV file using the MakeXYEventLayer_management and trying to use the SelectlayerByAttribute_management function, but I am getting error message saying on "Object ID(OID)" is present.. Is ...
0
votes
0answers
19 views

Make a XY Event Layer into Copy Feature layer

I am taking a CSV file and importing it with the XY Event feature layer. I then am trying to use the Copy Feature tool to get "Object ID" assigned to each row in order to run an attribute query. My ...
1
vote
3answers
246 views

Arcpy - Apply symbology to Feature and add to data frame

I need to create a shapefile from a csv, apply symbology from a saved layer, and export the result into an PNG. My code works up through the shapefile creation part, but it is not applying the ...
0
votes
1answer
101 views

Adding raster layer to map in ArcGIS Pro project using ArcPy not working?

I have a raster dataset in a geodatabase and I would like to add it to my map using arcpy. I have tried with the following lines of code but it doesn't work (no error thrown): raster_data = r'D:\...
-2
votes
0answers
18 views

Error during FillSinks - ArcHydroTools

I'm trying to use FillSinks by ArcHydroTool an error appears when I run this code: import arcpy import ArcHydroTools from arcpy import env ws = env.workspace = r"C:/Users/fractal/Desktop/...
0
votes
1answer
32 views

ERROR 000840: The value is not a Raster Layer

I'm getting use FillSinks by ArcHydroTools but some problems are happen. I use this code: import arcpy import ArcHydroTools from arcpy import env ws = env.workspace = r"C:\Users\fractal\Desktop\...
0
votes
1answer
22 views

ArcPy updating fields from another table

I'm trying to update missing values in one .shp from another .shp. I'm using SelectLayerByLocation to identify the properties which lie within the boundaries of a suburb and then using a UpdateCursor ...
1
vote
1answer
2k views

Using arcpy.da.UpdateCursor with dictionary?

I'm working through some da.UpdateCursor scripts to make updates to a fgdb. Although the script below works successfully, I want to use the dictionary that I have created rather than the manual [ ] ...
2
votes
1answer
81 views

Distinguishing between Layers and TableView using ArcPy?

I am working with ArcMap and am using ArcPy. My task is to loop through mxds and find broken data sources. My code is: mxd = arcpy.mapping.MapDocument(fullPath) brknMXD = arcpy.mapping....
2
votes
3answers
62 views

Using ArcPy to Move Feature Classes to Feature Dataset?

I have a File Geodatabase. I am using Python to manipulate data. I have a bunch of Feature Classes in the root of the FGDB. What I need to do is to loop through them and move all of them into a '...
2
votes
2answers
114 views

Adding Coordinates to shapefile using ArcPy?

I want to add latitude and longitude column and their values in decimal degrees to my shapefile (fishnet). How to use ArcPy for that? I have added lat and long using arcpy....
0
votes
1answer
25 views

ArcPy Update Cursor Not Populating Field?

I recognize similar questions have been asked but I have yet to see what my code is lacking in any of their answers. I am trying to use the code below to periodically update attributes in a Feature ...
0
votes
1answer
32 views

ERROR 000732: Output Location: Dataset results does not exist or is not supported?

I'm trying to use MosaicToNewRaster but a lot of errors are appears. One of them is: ERROR 000732: Output Location: Dataset results does not exist or is not supported My code is: import ...
5
votes
3answers
9k views

Using selection of features in ArcMap in Python script?

I am trying to write a python script and am stuck on the first obstacle. I want the user to select features in ArcMap and then use these selected features in a python script. Is that at all ...
0
votes
1answer
46 views

arcgisscripting module not found in Python 3.5 in Spyder IDE

I am running ArcGIS Pro 2.2 and I have cloned my conda environment from Python command prompt. When I activate this environment and attempt to run Python 3.5 from the terminal, I can load arcpy as the ...
0
votes
1answer
106 views

Iterating folder of shapefiles using ArcPy and exporting mxd to PDF

I'm new to Python and just created a hard coded script for the process I want, and it works. Right now it calls on the one of three shapefile I have in this map document. I want it to do the same ...
1
vote
1answer
38 views

Printing attributes of selection in ArcPy?

I'm trying to use ArcPy to print a list of addresses of land parcels crossed by a power line. I'm using the following code to accomplish this: # Loop through features in parcels.shp for feature in ...
0
votes
0answers
30 views

Multiple selections with a python loop

I am very new to Python and have no idea about how to write a python loop to do selections for ArcGIS. I already finished writing selection codes with different conditions. Is there anyone helping me ...
-1
votes
1answer
46 views

Merge and save results after selections using loop

I want to merge shapefiles after selection inside a loop and then save results to excel files. However, the codes could save the last result to excel files and can not save each merge file. import ...
-2
votes
0answers
23 views

Merging and exporting results inside for loop using ArcPy? [duplicate]

I write several for loops in python and want to get the merge results, and then export as excel files. Here are my codes. import arcpy arcpy.env.workspace = "D:/STAR/GISpro.gdb" arcpy.env....
0
votes
1answer
27 views

Select by attribute with field equal to element of vector in ArcPy?

I am trying to select by an attribute with a condition that field equals to an element of a vector. I use a for loop but could not get the right expression for this condition. Here are my codes. ...
1
vote
0answers
25 views

Python Stand Alone Script Parsing error SyntaxError: invalid syntax (line 1)

I'm pretty new to python, but I'm trying to transpose a time field for a set of data I'm working with in ArcMap. I changed the file locations and fields to my needs. However, when I try to run the ...
9
votes
7answers
5k views

Dividing polygons into *n* number of groups of equal counts with ArcPy?

One of my tasks for work is to divide parcels into groups. These groups will be used by agents to talk to property owners. The goal is to make the agent's job easy by grouping parcels that are near ...
0
votes
1answer
18 views

Identifying intersections in ArcPy? [on hold]

I have two shapefiles: one containing a single polyline feature, and the other containing a number of polygons. I'm trying to use ArcPy to identify which polygons are crossed by the line, and then ...
6
votes
0answers
45 views

Python Script Performance as an ArcGIS Tool Versus Stand-Alone

Has anyone studied the difference in running a Python script in ArcToolbox versus as a stand-alone script? I had to write a quick-and-dirty script to convert a set of RGB images to single band by ...
1
vote
1answer
33 views

Can arcpy read dynamic text as appeared in ArcMap?

Just wondering if we can read dynamic text in arcpy? For example, assume we have a Text Element called myText which contains a piece of dynamic text Map <dyn type="page" property="index"/>. ...
0
votes
1answer
81 views

Computer Locking GDB When Running Scheduled Task

I am currently downloading and unzipping a GDB every night through the use of Task Scheduler. Then I update a related GDB with the changed features in all of the feature classes. My issue is, the ...
1
vote
0answers
18 views

Controlling field names with arcpy.Combine?

If I run the arcpy.Combine command as such: result = arcpy.Combine(["CDL/raster07", "NHD/raster07", "OtherRaster"]) The resulting raster has an attribute table with fields [f.name for f in arcpy....
1
vote
1answer
58 views

ArcPy Geocode Addresses works in ArcPy window but not in a standalone script

This issue sounds like a repeat of ArcPy function works in ArcMap Python window but not from standalone script? but I am receiving a different outcome so this is why I am posting here. The following ...
1
vote
1answer
15 views

Closest Facility routes do not align with network dataset

I am running both Service Area analysis and Closest Facility analysis using the same network dataset, StreetMap Premium 2017R3. The service area lines exactly line up with the underlying street ...
1
vote
1answer
72 views

Error when clipping multiple rasters

I am trying to clip about 36 rasters by a polygon. However, I am running into an error. It isn't a coding problem with the loop because I receive the same error when I run the function on a single ...
0
votes
0answers
47 views

Making ArcPy script quicker? [on hold]

The script below is used to update a shp which is missing values from another .shp using a spatial reference. It's taking about 19 minutes to run through ~53,000 rows. Any ideas on how I can make it ...
1
vote
1answer
19 views

Extracting field value from Info table( .info ) in ArcGIS

I am working on a Python snippet try to use arcpy.da.SearchCursor() to extract value of certain field from a Info Table which generated by executing arcpy.Statistics_analysis().Here's my code: arcpy....
0
votes
1answer
162 views

Listing all points in polygon geometry using arcPy [closed]

Based on my understanding in coding, I thought the following code will list all points in every feature in my Building polygon feature class: arcpy.env.workspace=r'D:\test.gdb' rows=arcpy.da....
1
vote
2answers
110 views

CreateTable_management as part of a script tool fail

I am trying to create a table as part of a script tool, and it always fails with error 999999. The general idea of the script is that it is calculating proportional coverage of things in a series of ...
2
votes
1answer
101 views

What permissions needed to add an index with a protected version?

Using arcpy and ArcGIS 10.1 SP1 (Build 3143) against an Oracle 11g enterprise geodatabase, I am trying to add an index to an existing attribute in an existing feature class: arcpy.AddIndex_management(...
1
vote
1answer
46 views

ArcGIS Pro Python arcpy.CreatePersonalGDB_management

I have an ArcGIS Pro Python script (please note it's version 3+ and to be precise shows as 3.66) and when I run the following command, I get an error. arcpy.CreatePersonalGDB_management(...
0
votes
0answers
24 views

Error in FillSinks with Python [duplicate]

I'm trying to use FillSinks from ArcHydroTools with Python My code is: >>> import arcpy >>> import ArcHydroTools >>> fill = arcpy.GetParameterAsText(0) + '\\fill' >>...
0
votes
0answers
20 views

Problem with Fill Sinks - ArcHydroTools

I'm getting use FillSinks of ArchHydroTools with Python but some problems are happen My code is: Import arcpy Import ArcHydroTools ArcHydroTools.FillSinks('projectraster.tif','fil.lyr', "10", "...
0
votes
0answers
5 views

Get Feature Service syncCapabilities with ArcPy

I'm working on an ArcPy script to test layers. I have either an arcpy mapping module layer object, or a feature service URL as a text string. I wish to get the feature service's capabilities, in ...
0
votes
0answers
7 views

Repoint enterprise geodatabase connection using ArcPy in ArcGIS Pro

I have an ArcPy script that changes the connection parameters for every item in a layer file from a SQL Server connection to a PostGIS connection. This script works perfectly in ArcGIS Python version ...
1
vote
0answers
24 views

Adding Raster Layer to CURRENT Map in ArcPy of ArcGIS Pro?

I am updating some ArcGIS toolboxes that contain python scripts to ArcGIS Pro. In many of them, I add the geoprocessing results to the map and symbolizes the layer for future processing (these are ...
0
votes
0answers
14 views

ArcGIS is importing orginal numpy while VirtualEnv is activated

I could activate ArcGIS's python command windows to use VirtualEnv by "execute execfile(r'C:\Users\jason\myenv\Scripts\activate_this.py', {'file': r'C:\Users\jason\myenv\Scripts\activate_this.py'})" ...
2
votes
2answers
4k views

Workspace already in transaction mode

I am writing a script to use an updatecursor. The feature class is locked so I am versioning the database, creating a feature layer, and reconciling versions. I have taken the skeleton for my ...
-1
votes
1answer
41 views

Taking data from a CSV file to create points on a shapefile [on hold]

I am trying to import data from a CSV file and write a script that will generate points on a new shapefile. I am running into issues for when I try to update the InsertCursor. I get an error of "not ...
-1
votes
2answers
81 views

How to iterate through date and time text file, line by line?

I am building a model on ArcGIS and I am now trying to iterate through a text file that contains in each line date and time information. I tried to do that on Model Builder, only I used the get field ...
6
votes
3answers
362 views

Some zones disappear when running Zonal Statistics as Table in ArcGIS

I'm new to GIS. I want the sum of nighttime lights (DMSP) by district for some country. I'm running this arcpy.gp.ZonalStatisticsAsTable_sa(Limites_distritales, "IDDIST", rc, temp_table, "DATA", "") ...
0
votes
1answer
27 views

Creating new layer/shapefile from each element using ArcPy?

How can I create a new layer (shapefile) from every element in another layer? I have point shapefile 'przystanki.shp' (in Polish mean bus stops) with 19 point and some attributes in table. What i ...
0
votes
0answers
9 views

Providing multiple inputs to Create TIN tool in ArcPy?

The documentation has a field where you can list the name of your shape, the field, and other variables, but does not give examples of multiple features. The standalone tool supports multiple features....
3
votes
1answer
26 views

Converting from custom projection northing/easting coords to lat/long in decimal degrees

I've got a custom projection file that's applied to all data (per request of a client), and another team is requesting ids/coordinate pairs for assets. I tried ripping out X/Y off the point data, but ...