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
1
vote
1answer
33 views

UpdateCursor: value from different rows (ArcPy) [closed]

I am new to ArcPy. I have an attribute table with the following columns and fields I want to fill up the column Combined as follows: If number contains 2 categories, "combined" will be A,B. If ...
1
vote
1answer
25 views

Performing DTM compression using ArcPy?

I have a set of 32-bit TIFF files of DTM data (50 sm) and I need to save them as 16-bit. In order to save some space, I compressed them using LZW algorith and saved as 16 bit tiffs using Arcpy. But ...
0
votes
1answer
48 views

How to get the “modified” date for a FeatureClass in a file geodatabase via ArcPy?

There is a closed question which is similar to or identical to this question: Getting date modified for a feature class within a file geodatabase via arcpy Looking at a file geodatabase featureclass ...
2
votes
2answers
53 views

Update 1 random value in a group of values

I have an attribute table with a date field and a random field. The date field has three different times for each day. I need to input a '1' in the random field for one of those three times in each ...
0
votes
1answer
51 views

How to fix this Heatmap script from failing SQL expression (integer/string?) using arcpy (ArcMap 10.5)?

I have a heatmap script that will eventually print 10 PDF maps. At the moment it is failing at the SQL expression in the Make Feature Layer right before Kernel Density Raster creation because the ...
1
vote
0answers
50 views

Datetime on attribute tables

I have written a script to add, among other stuff, a datetime column. I have used the arcpy.AddField_managementcommand, but it didn't have a 'Datetime' type, so I used the 'Date' type : arcpy....
0
votes
2answers
50 views

Automating Excel to Table in larger script in ArcMap using Python?

This is the first part of a larger script i'm working on to automate heatmaps. Currently I'm receiving this error with ArcMap 10.5: Traceback (most recent call last): File "\coacd.org\dfs\SWS\...
0
votes
1answer
40 views

Multiplying points to another feature table using ArcPy?

I have a point feature class like this: And another table looks like this: How can I add point's xy coordinate to that table based on their No. and automatic multiply as their No. multiplies using ...
0
votes
1answer
31 views

Simplifying a long if condition statement and adding status report?

def Assign(csdname, cdname, ccsname, zone): if csdname == "Oshawa" or csdname == "Whitby": return "70" elif csdname == "Toronto": return "71a" elif csdname == "Mississauga" or csdname == "...
1
vote
0answers
29 views

Copy_raster to remove no data value using ArcPy

I have multiple raster, I am trying to remove Nodata value using Copy_raster option. Since I have multiple raster, I am running a ArcPy script, save the raster as same input name. But that script, ...
1
vote
2answers
42 views

Merging feature class with field mappings using datum transformation?

I suspect that there is no easier way to do this, other than developing this as a two-step process with a temporary output (which seems somewhat wasteful). If I have to, I'll just create a temporary ...
0
votes
1answer
29 views

How to update attribute of selected features in ArcMap with a shortcut?

I have to edit/move/create/delete a no of polygons based on their respective comparison with reality. For all the polygons that I've moved, I have to update a field called remark as "U". This is ...
2
votes
1answer
107 views

Using if statement with ArcPy and GetCount?

I am looking to get a count on the polygonNieghbor and if it has polygons in it then I want to move to the next step MakeFeatureLayer. and If it doesn't have any features I would like it to finish. ...
2
votes
1answer
25 views

Dynamically set default file geodatabase to newly created one in for loop with ArcPy

I'm trying to write a script for a tool in ArcGIS Pro 2.x for an annual workflow where I create five time-peroid directories (named 1-5) and then I create both a new file geodatabase and an ArcGIS Pro ...
-1
votes
1answer
53 views

Making looping through line segments for vertex points faster?

I am trying to speed up some current code that I have for looping through lines, getting their segments and ultimately the vertex points in Python. Can anyone recommend a faster method than what I ...
0
votes
0answers
24 views

Updating .aprx file after creating new layer using ArcPy?

I use arcpy function XYTableToPoint_management() to create a new layer vessel_coordinate into the current active map, as shown below. But when I list the layers in this map (map.listLayers()), I hope ...
0
votes
1answer
28 views

arcpy.AddJoin_management() Error [closed]

I'm having an issue with some code I'm trying to write. Here's the code and below that is the output. # -*- coding: utf-8 -*- # -----------------------------------------------------------------...
1
vote
2answers
49 views

Sorting MXDs with specific attributes and exporting to specific directory?

I'm working on creating a GP tool that simply exports all MXDs in an input folder into an output folder as PDFs. This actually works, but I messed something up with output directories. I coded ...
3
votes
1answer
44 views

Applying Definition Query for multiple features using ArcPy?

I'm trying to apply the following code to extract features that contain these letters 'MW' within the field called 'CODE' for multiple layers. But I'm getting a SyntaxError for line 5 (defintion query)...
1
vote
1answer
26 views

Changing map symbology with arcpy?

I've written a program that maps out a specific point file of interest. The program produces a map (clipped map attached below) but I can't figure out how to change the symbology to different colors. ...
1
vote
1answer
43 views

How can I handle ArcMap events of CREATE, UPDATE or DELETE?

As a developer I can use ArcPy (Python) or ArcObjects (.NET) to develop some extensions or tools for ArcGIS platform. But I need to handle some events. When a user connected to an Enterprise ...
1
vote
0answers
36 views

How to copy all files with extension type to a folder? [closed]

What is the best way to go about this? I'm able to do it with a single file as below, but what if I would like to copy all files with .txt to a folder, and all files with .docx to another folder. I ...
0
votes
1answer
21 views

How to use insert extension for more than one value

I am trying to insert 2 values into the 'extensionsofArcGIS' variable as you can see below, just not sure how to insert more than one at a time? I have tried a few different variations but still no ...
0
votes
1answer
44 views

How can I insert degree symbol to attribute table in feature class?

I am trying to insert a bearing string into an attribute table, I want the string to look like this -> S 58°15'31" W , but what I am getting in the table is this -> S 58°15'31" W The code I am ...
0
votes
1answer
40 views

arcpy.da.UpdateCursor not updating [closed]

The script will run without error, but the updatecursor at line 123 does not update the table. the addmessage before and aftr the loop shows right numbers but update does not seem to work. # -*...
1
vote
1answer
23 views

Locating records not in selection using ArcPy?

I have a list of addresses that I need to contact. Some are listed in the attribute table, and some aren't. I'm trying to find the ones that aren't. The list: contacted = ['123 STOWE ST', '123 ROSE ...
0
votes
0answers
16 views

Converting line density layer into classified raster using applied symbology in ArcPy?

Using python in ArcCatalog 10.6 I am trying to apply symbology to a line density layer. I sliced the density map into 9 segments and that is how I want to apply symbology from a predefined layer. It ...
-1
votes
1answer
21 views

Viewing shapefile's attribute table using ArcPy? [closed]

How can I view the attribute table of a shapefile or a raster file as a database using ArcPy?
2
votes
1answer
22 views

Getting error when removing join using Arcpy

I have joined a CSV table to a raster layer, now I am trying to remove the join. I have typed the following command: arcpy.RemoveJoin_management("hwsd_lyr",hwsd_csv) It gives the following error: ...
0
votes
0answers
24 views

What analysis tool I can use to identify the relation between points and areas

I want a binary result for each purple point in this map, i.e. whether in or out od the blue polygon areas? In this case, one is in and the other is out. What analysis tool in ArcGIS Pro (also arcpy ...
1
vote
1answer
33 views

Use Python to find points based on 'month' and 'year' fields

I have a shapefile based on 27 locations, with historical values at each location for each month of the year going back to 1974. The file has 11,000 values. I have been trying to work on a script to ...
3
votes
1answer
24 views

LayerToKML output doesn't render on Google Earth

For the last few weeks I've been making .kmz files using LayerToKML_Conversion with no problem. They open in Google Earth perfectly. Today, they suddenly stopped rendering at all. When I click the ....
0
votes
1answer
25 views

Adding output to ArcPy script in ArcGIS ModelBuilder?

In ArcGIS 10.5, I have the following script which grabs the files from a geodatabase and merges them into one layer: import arcpy # specify the path to the GDB with the asset files #make sure the ...
1
vote
1answer
48 views

To update Point location every 1 second

I am using update cursor to change the location of a point with FID = 0 every second, but whenever I run the code my ArcGIS freezes and point doesnot move. I am visualizing an output where the point ...
1
vote
1answer
26 views

Add date and time to attribute table using ArcPy insertcursor

ArcPy under ArcGIS Pro 2.3.2. I am adding a Python datetime.datetime object to a shapefile attribute table using an arcpy insert cursor. The problem is that when I add the datetime instance, the date ...
0
votes
1answer
24 views

Exporting feature class to geometry objects and preserving attributes - ArcGIS, ArcPy

I'm using ArcPy and would like to copy features in a feature class to geometry objects and then perform a buffer on the geometry objects and copy them back to a feature class. I am doing this in ...
0
votes
1answer
34 views

Centering Feature before exporting map to PDF?

I am trying to export single point file maps to PDF. My maps are exporting fine, but I'm having trouble centering the point file in the middle of the map, it's always outside of the data frame. Any ...
1
vote
1answer
42 views

Filling a dictionary whose values are a list container

import arcpy, datetime arcpy.env.overwriteOutput = True # Number of days to subtract tdelta = datetime.timedelta(days=21) fiberCable = r'C:\Users\broadhurstn\Documents\ArcGIS\Default.gdb\...
0
votes
1answer
21 views

Iteration of AddJoin to join CSV files and a geodatabase feature class file

I have a geodatabase feature class file and I want to join the feature class file to CSV files respectively. For example: Join the geodatabase feature class and CSV 1 => save as CSV 1 in gdb. ...
1
vote
1answer
18 views

Printing/displaying coordinate system of several raster files using ArcPy? [closed]

How can I extract the Coordinate System of many raster files (GeoTIFF) so the information is displayed, and I can ascertain that all of them are correctly settled in the same projection, using ArcPy? ...
0
votes
1answer
33 views

Add-In to Switch Selection [ArcMap 10.4]

I'm creating a suite of add-in tools on a tool bar, and using this tool as a test. How I want it to work is thus: I have a buffer which has already been cut up by a line feature class I select the ...
3
votes
1answer
75 views

Performance of arcpy.Exists() in SQL Server enterprise gdb environment

While iterating on a list containing table names, I used arcpy.Exists() to check if a table/featureclass exists. This action is very time consuming. I've ended up using a database approach select ...
0
votes
1answer
40 views

Using Cumulative Geometry Calculation to Add Field in ArcPy

I am using Desktop 10.6, Basic license, Spatial Analyst, Python 2.6, 2019 AD. I have 4 overlapping features in a polygon feature class. I'd like to sort the features by the depth field, calculate the ...
0
votes
0answers
28 views

Release SDE locks from arcpy.da.Editor in same process

Is it possible to use arcpy.da.Editor and have it release its SDE locks in the same process? I am using arcpy and trying to perform edit operations on an SDE version, then reconcile/post/delete the ...
0
votes
1answer
54 views

Using Editor tab Clip function in ArcPy?

I am using ArcGIS Desktop 10.6, basic license, Spatial Analyst, python 2.6, 2019 AD. I have a polygon feature class with representing a lake, with multiple features overlapping (all in the same ...
0
votes
2answers
53 views

Converting REST Service to file geodatabase feature class?

I'm trying to convert a rest service to a feature class but Python is getting hung up in the middle of the process. Input: import arcpy import urllib import json # Setup arcpy.env.overwriteOutput =...
0
votes
2answers
35 views

Getting SyntaxError from ArcPy Select by Layer?

I am currently wondering what is the fastest way of using Select By Attributes in arcpy. I have a GDB with a feature class that is quite big. This feature class has a field called CODE with values of ...
1
vote
0answers
35 views

Creating Field Mapping Parameter in Arcpy Script

I'm trying to create a tool that compares two data sets. I do not want the Feature Compare tool. Most of the field names in the two data sets are the same, but not all. I want a way to map one field ...
2
votes
1answer
70 views

Changing min max of Stretched Raster with ArcPy?

I have two rasters r1 & r2: Maximum cell value of r1: 0.9 Maximum cell value of r2: 0.3 Minimum value for both is 0 I am using a color gradient: white - yellow - green - blue - red - black ...
1
vote
1answer
34 views

Accessing fields info from code block using Python Parser of Calculate Field in script?

I need to codify a field with other fields information I have this code running into a script: # Process: Calculate Field (12) arcpy.CalculateField_management(RedHID_Layer, "TIPOcorr", "...