Stack Exchange Network

Stack Exchange network consists of 174 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
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [arcpy]

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

1
vote
0answers
12 views

Is it possible to extract the projection from each LAS file in a directory using ArcPy?

I am using ArcPy to automate the conversion of LAS files to Raster in ArcGIS. I'd like to extract the spatial reference from each LAS file along the way, is it possible to do this using ArcPy tools?
0
votes
0answers
18 views

Calculating sequential numbers into sorted table not dependent on OBJECTID?

I am having a problem with adding sequential numbers to the new column based on other sorted value. I would like to use 'Sort by' column to be able to generate numbers in the 'Required number'column. ...
2
votes
3answers
62 views

Comparing value with value from the next row

I have a table with two elements in this format: a b b a b c c b c d ....f g g f I have to analize if the second element is equal to the first element of the following row. If it's true, 1 is ...
0
votes
1answer
20 views

UpdateCursor cannot see new field added to feature class

I needed to add a new field to a feature class to act as a unique key, but when I run: fields = ['OID@', 'state', 'navkey'] ids = inspected_points #list of oid values oidfield = arcpy.Describe(points)...
1
vote
1answer
26 views

What is happening different to my TIFF between export data and arcpy

I am working in FME with TIFFs downloaded from sentinel-1 (SAR). These TIFFs display correctly in ArcMap but in FME is loses its spatial reference and a bound box calculation gives the number of ...
0
votes
2answers
34 views

Arcpy - Python script select many values from attribute table raster

I run this simple script, line-by-line, and I get the error Runtime error SyntaxError: can't assign to literal (, line 1) What am I doing wrong? import arcpy # Set workspace arcpy.env.workspace = ...
-1
votes
1answer
29 views

Exporting Data Driven Pages as multiple JPG files using ArcPy? [on hold]

I am struggling with finding a phyton code that will allow me to export all pages of DDP as 'Multiple jpgs' with the resolution of 300dpi. So far I got this code but it does only export the last page ...
0
votes
2answers
20 views

Using ArcPy with ArcMap Layout View to ExportToTiff with geotags?

I feel like this should be a lot easier than it is, all I am trying to do is create a geotiff that contains spatial referencing from arcmap in an automated manner as I have thousands to create. ...
1
vote
0answers
20 views

arcpy.Near_analysis throws error: feature class does not exist or is not supported or cannot add field NEAR_FID

I am trying to determine the closest line feature to features in a point feature class by using the arcpy.Near_analysis function, as such: search_radius = '' #optional location = 'LOCATION' angle = '...
0
votes
2answers
23 views

If field 1 > field 2 update field 3 in loop

I am trying to update the table above. What I want to do is if the values in the PMP fields are less than the Max fields update the check fields with PASS, if not FAIL. I started doing this trying ...
0
votes
1answer
49 views

Delete vertices on polygon feature class, based on the intersection with point shp with python

I need to delete some vertices from some polygon fc that are unnecessary for the geometry. I have a point shapefile that contains all unnecessary vertices as points - but how can I access the vertices ...
2
votes
1answer
38 views

Reference ObjectID in a where clause within an UpdateCursor

I have a dynamic list of ObjectID values I need to filter an UpdateCursor on. I am setting a where_clause as: where_clause_points = "[ObjectID] IN({0})".format([x for x in inspected_points]) Which ...
0
votes
1answer
41 views

Importing CSV to shapefiles using loop?

EDIT - Code now runs correctly. I wasn't able to properly indent "arcpy.AddField_management" here for some reason; move it two spaces to the right if you use this code. I'm adapting this code to ...
0
votes
0answers
11 views

Conversion to KML won't convert whole layer

I'm trying to convert a vector layer to a KML file. Here's what the layer looks like in ArcMap-- as you can see, it has multiple polygons: Here's my code: import arcpy arcpy.env.workspace = r'C:\\...
0
votes
0answers
18 views

Seeking Tools for Splitting Line Strings to use with Parcel Fabric and Python?

I have only been working with parcel fabric for a little over a month now. So far I am cleaning up overlaps, but line strings get in the way. As I fix line strings, particularly with road right of ...
1
vote
2answers
34 views

Sort by multiple fields and delete record with highest value

I have some GPS points that I am trying to find the highest precision point for. How would I go about sorting the table by time collected and horizontal precision and then deleting the highest ...
2
votes
2answers
46 views

Selecting all values with <Null> by using SelectLayerByAttribute_management with input Parameter

I am trying to select all values with Null by using the SelectLayerByAttribute_management. But the Fieldname in the where-clause is alterable by using the input-parameter. That is what i tried: if ...
2
votes
1answer
40 views

Refering to (Joined) Field Names in arcpy in Field Calculator

I'm trying to update the locations of a point FeatureClass using a table. I have joined the table to the featureclass, and am attempting to use Field Calculator to update the SHAPE field. I found ...
0
votes
1answer
24 views

Using input parameters to select layer by attribute

I am trying to create a Python-Toolbox with following Tool: inputFeature: A User has to load a Feature inputField: Then he has to to select a field from the Input Feature inputValue: At the end ...
0
votes
1answer
46 views

Getting (X,Y) projected coordinates of point instead of its longitude and latitude in ArcPy?

I am reading a shapefile through ArcPy. The shapefile has both geographical coordinate system and projected coordinate system. When I try to get the coordinates of a point geometry in the shapefile, ...
0
votes
0answers
13 views

How to shift set of points, which represents surface in 3D, by constant distance perpendicular to surface? [closed]

I am trying to shift the points, which represents surface in 3D, to create a new surface on top of the old one. I have the following data sets surface points (format: long, lat, radius) and dip, ...
0
votes
1answer
32 views

arcpy.AddGeometryAttributes_management throws error: error in executing tool

I am trying to add XY extents to point and line features using the arcpy.AddGeometryAttributes_management tool, but it throws an error: RuntimeError Traceback (most ...
2
votes
1answer
40 views

Finding tables related to layer using ArcPy?

We have an ArcGIS map service that includes about 50 layers, and many of them have related tables. I need to build a schematic of this service that includes layer name, source feature class (or table),...
1
vote
1answer
35 views

SelectLayerByAttribute_management searching with different datatypes

I am trying to use the SelectLayerByAttribute_management in a tool. The tool works like that: The User puts in the Feature which Layer should be selected by attribute -> "inputFeature". Then he ...
1
vote
3answers
32 views

Deleting blank fields in multiple shapefiles in folder using ArcPy?

I have some shapefiles and each shapefile is having some blank or zero value fields. My task is to delete blank/zero value fields for all shapefiles in the folder. I have searched for solution in ...
0
votes
1answer
44 views

Using centroid point to generate polygon using ArcPy? [closed]

Is this possible to generate polygons from points (which are centroids of future polygon)? I got shapefile with ~250 points + they have got two attributes: length and width. I don't need complete ...
0
votes
1answer
25 views

Loop through two raster datasets by order and perform a function

I have two raster datasets that I need to loop through by order and select the first raster from the first dataset with the first raster from the second dataset to perform a function. I keep getting ...
0
votes
0answers
18 views

ArcMap's SegmentMeanShift tool fails in standalone script

The tool requires a Spatial Analyst license. It runs fine in the ArcMap Desktop application, but not when I port it to a standalone script using the outline here: Segment Mean Shift - Help It returns ...
3
votes
2answers
106 views

How to Refer to a Null value with ArcPy Expressions

I feel like this might be a bit of a simple answer but I can't figure out how to refer to Null values in a field using an expression in python. I've tried using the following as well as = None and =...
5
votes
1answer
53 views

arcpy.env.overwriteOutput() not working with arcpy.FeatureClassToShapefile_conversion()?

I have created a simple model to transfer multiple feature classes to a shapefile. With the model I exported a .py script which I'd like to run with my task manager to update any changes each day. ...
0
votes
2answers
53 views

How to densify point feature class in ArcGIS?

I have a 3D (x,y,z) single point feature class which points are equally spaced, like this: As the distance between each points are more than one meter, I was wondering if there's a possibility to ...
0
votes
2answers
28 views

Top percentile in zonal statistics - ArcGIS

This is quite a simple question and I'm sure it's possible as I've seen it referenced in research articles (e.g. here, p.38). I have a raster with continuous values (0-1), and a vector dataset of a ...
0
votes
3answers
56 views

Using ArcPy to ListFields inside SearchCursor?

The current code I have simply lists ALL fields in the feature class and seems to ignore my logic of if row[0] is not None: Why does it do this? fields = arcpy.ListFields('\\\\Bvweb104draco\\e\\...
0
votes
1answer
31 views

Alignment and distribution tools for shapefiles?

Does anyone know of a native Esri tool, Python, or R package that would allow one to emulate arcmap's graphic element toolbar functionality, but for shapefiles rather than graphic elements? For ...
0
votes
0answers
36 views

ARCPY UpdateCursor using a Where Clause - not updating table

I have a code that should take a table in a connected database, do some math to the geometry (makes lines straight) and then update the table data. It works up until updating the connected database - ...
0
votes
1answer
25 views

MultiValue Selection with MultiValue Input

I made this Python Toolbox as a practice run for a larger project I want to do as I am new to python toolboxes. While this was successful I am not able to the result that I want. I want to be able to ...
1
vote
2answers
43 views

Running arcpy.AlterField_management 2,000 times takes too long?

I am trying to replace field names of a table stored in a file geodatabase using a dictionary as a lookup table. My field names got cut off from the Tabulate Area tool (Tabulate Area Truncates Field ...
1
vote
3answers
51 views

Search Cursor Return Field Name If All Rows Contain a Value

I'm trying to print the field name to a list if all rows in that field are not NULL. Here is the logic I have so far. fiberCable = r'Orlando\Orlando_FIM_prep\FIBERCABLE' list = [] with arcpy.da....
0
votes
1answer
31 views

Adding data to a feature layer on ArcGIS Online using arcrest and arcresthelper.featureservicetools?

I'm attempting to automate some web map updates on ArcGIS Online through the use of the arcrest module. The following two methods are intended to act as the interface between local data sources and ...
0
votes
1answer
23 views

Python to generate a different number of random points for features using iteration with tool parameter values in feature attribute table

I want to generate a certain number of random points in N number of zip codes. The number of points to be generated for each individual zip code is stored the attribute of the feature class of all ...
1
vote
1answer
32 views

Using the arcpy Python library with hosted feature service layers from ArcGIS Online?

Is it possible to use the arcpy library with hosted feature service layers from ArcGIS Online? I am aware of the ArcGIS API for Python, but the API lacks many of arcpy's features. In my case, I'd ...
2
votes
2answers
92 views

Update records with ArcPy update cursor? Geodatabase format

I try to update thousands of rows when all records get the same value. My code has a loop that runs thousands of times. Is it possible for the program to make the change to all the columns in one ...
1
vote
1answer
38 views

Creating point feature class from multiple points using list comprehension and ArcPy?

import arcpy sr = arcpy.SpatialReference(4326) # Create polygon 2 x 2 with LL corner at 0,0... coords = [[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]] polygon = arcpy.Polygon(arcpy.Array([arcpy.Point(*a) ...
1
vote
1answer
44 views

Joining single column in ArcGIS Desktop with Spatial Join

I'm trying to automate a rather annoying workflow in ArcGIS 10.4 with a Python script. My goal is to extract data from a polygon shapefile into another polygon shapefile which is arranged as a raster (...
1
vote
1answer
39 views

ArcPy cursor get value in next row [duplicate]

I am trying to populate Field B based on the value in Field A and the next value in Field A. I'm having trouble with the syntax for getting the "next" value in Field A. Here is my current code: with ...
1
vote
1answer
23 views

Query feature class on attribute value, and generate Python list of feature classes

I want to query a feature class on attribute 'state' == 'new', and if so, add that feature class record to a list (I will process this list later). I have: cursor = arcpy.da.SearchCursor(points, '...
1
vote
0answers
15 views

AGOL: Overwrite existing tile service - Invalid min scale in the specified source item

I'm trying to automate updating a tile service where: TPK is generated from a feature class in an .mxd (data frame is web mercator) TPK is pushed up to AGOL Tile Service is published TPK is deleted ...
1
vote
1answer
35 views

Execute Oracle stored procedure from ArcSDESQLExecute

I'm attempting to execute an Oracle 12c stored procedure using ArcSDESQLExecute: import arcpy egdb_conn = arcpy.ArcSDESQLExecute(r"Database Connections\con1.sde") sql = '''execute update_sle (...
0
votes
1answer
23 views

How to batch geoprocess using iteration with tool parameter values in table [closed]

As part of my work at a non-profit, I am preparing a map for an upcoming legislative session. GIS is only a small portion of my job. I am comfortable with ArcGIS but have no experience with Python (I ...
1
vote
1answer
17 views

Changeing Display cache path permanently in ArcMap?

I'm looking for a way to change the Cache path of ArcMap permanently. So from - C:\Users\$username$\AppData\Local\ESRI\Local Caches To a seperate drive - E:\Users\$username$\ESRI\Local ...