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.

-1
votes
2answers
34 views

Deleting all tables with similar names using ArcPy?

I have created many tables using Python and want to delete all tables with similar names. For example, I need to delete all tables ending with "level1", "level2" and until "level7". Also, I need to ...
-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....
4
votes
1answer
83 views

Update Cursor skipping last row?

I have created a python function within field calculator to calculate the time difference between a timestamp (yyyy-MM-dd HH:mm:ss) in a row and the row after (the interval field in seconds). I have ...
1
vote
0answers
19 views

Getting ArcMap layer with symbologyType = “UNIQUE_VALUES”?

I am trying to write an automated mapping script to set new categories for a layer on each iteration, however I have encountered a problem. If I understand it correctly may layer's symbologyType ...
1
vote
0answers
27 views

Sorting massive amounts of geospatial data based on location and scale using Python [closed]

I have a few terabytes worth of geospatial data. Raster, matrix, imagery and vector, everything from point shapefiles of gas stations in a local area to country overviews. Some of the data is good (...
0
votes
2answers
57 views

ArcGIS 10.5 Python toolbox problem SelectLayerByAttributeERROR 000358: Invalid expression Failed to execute

I am trying to create a .pyt that find and select an object in an specific layer but I have a problem. I'm working on the Desktop version 10.5 and actually the code is this one: def getParameterInfo(...
1
vote
2answers
38 views

arcpy.Select_analysis choosing only a fraction of the record

I'm trying to divide up a feature class into a number of smaller sets. I have been using Select_analysis with objectid to divide up the featureclass so far but know that this is not the best method. ...
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. ...
0
votes
0answers
23 views

Saving matplotlib map to shapefile in python?

I already plot a prediction map I made with xgboost modal by matplotlib function and I want to save this map as a shapefile so I can work with it in ArcGIS, how can I do that? Picture of the map:
0
votes
0answers
31 views

Cannot delete geodatabase while tool is running?

I have created a script tool that performs raster analysis. It publishes intermediate raster layers to a newly created, temporary workspace (in_memory does not work well with rasters so I don't want ...
0
votes
1answer
13 views

Creating user defined input to simplify Reclassify tool and negate need for remap

I would like to build a script tool using Arcpy that reclassifies a raster layer based on a single user input parameter. For example, if the user inputs the number 7, then 0 - 7 would reclassify as 1, ...
-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 ...
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 ...
0
votes
0answers
32 views

Performing raster analysis using Arcpy - in_memory does not preserve raster shape

I am creating a script tool using Arcpy and it transforms elevation data into a final clip polygon as part of a lengthy site selection tool. When I perform the raster analysis and save my intermediate ...
0
votes
1answer
16 views

Surface and Volume from TIN read through text file?

I am trying to create a script that will iterate through a list of elevations in a text file and calculate surface and volume using the 3D analyst surface volume tool. I have success for the first ...
2
votes
3answers
60 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 '...
1
vote
2answers
52 views

Search Cursor to apply summarize statistics to all the row in a column

I use the following logic in ModelBuilder to get a result as seen below: A feature class has a Column with the name "Value" which is passed through to the Summary Statistics Tools which calculates ...
0
votes
1answer
62 views

da.InsertCursor not adding correct point

I'm iterating a dictionary and inserting rows however, the shape is not inserted correct. All the rows ends up with the same shape. My code: fc= r'C:\Connections\c\Osa\OSA@cB.sde\dvdb.Dv.E\Dv.Dv....
2
votes
1answer
39 views

Write accent mark in .shp and .dxf filename

I'm trying to export with python 2.7 some shapefiles and CAD files that could have specials characters in their filename, like accent marks. In example, I want to have this: ...
0
votes
1answer
36 views

SDE to CSV slow transfer speeds

I'm trying to move a feature class on our network SDE that's made up of polylines as a CSV file to the local machine (or fileGDB but slow speed seems to be the theme regardless of output format) ...
-1
votes
0answers
29 views

Projecting many raster files to coordinate system using ArcPy gives ERROR 999999?

I am very new to Python and trying to project many raster files using arcpy. Here is the screenshot of my raster files. These raster files have an unknown coordinate system but I can project them ...
0
votes
1answer
28 views

Selecting just the first row from a search cursor

Currently I am trying to select the top row of a feature class which is sorted using a Count field. I then would like to run the script a second time but the result will then be the second row of the ...
0
votes
0answers
11 views

Update a join table in SDE

I'm trying to make edits to a versioned SDE Feature Class. I joined a table that contained a list of all the point IDs that need to be updated. I called these PT_ID1 and joined them with PT_ID in the ...
0
votes
0answers
23 views

Apply .lyr Symbology To Layer Names That Meet if Condition

I am trying to create a script that applies a layer style from .lyr file to layers in my table of contents that meet a certain criteria. The criteria being the layer name must contain string of "x". ...
0
votes
0answers
17 views

ArcPy copy structure of group layers then copy feature layers to this structure

I have ArcGIS project (.mxd) with group structure like shown below with some feature layers inside (which are stored in file geodatabase). What I need is to copy group structure from "old_layers" to "...
1
vote
0answers
15 views

ArcPy Rematch tied addresses according to a separate column value

I have address data that returns many ties when geocoding using a Locator I created. The Locator uses a table that has grouped addresses based on street number ranges, e.g. |Start_Street_Num | ...
0
votes
0answers
33 views

Retrieve attribute with max value by group

I have a intersected counties shapefile with wind potential category attribute. What I want to do is to dissolve the features grouping them by county, and retrieve the WPC value which has the largest ...
1
vote
1answer
55 views

Python toolbox documentation from within pyt file

Python toolboxes are a great way to create custom, GUI toolboxes for ArcGIS without actually interacting with the GUI (since everything can be defined within the pyt file). Regrettably (and ...
1
vote
0answers
38 views

Arcpy multiprocessing arcpy.Select_analysis

I have the following script: import arcpy from arcpy import env import datetime import os env.workspace = r"Q:\\SDE\Direct Connection to Contours.sde" dataFC = arcpy.ListFeatureClasses("","","...
1
vote
2answers
54 views

Taking parameters from users in ArcPy via IDLE?

I wonder if we can use arcpy.GetParameterAsText(0) in Python IDLE to get a parameter from a user? I am using ArcGIS Desktop 10.4 and Python 2.7.10 that comes with ArcGIS. Actually I want to know how ...
2
votes
1answer
91 views

Adding data to subgroup layers with same name in ArcPy?

Assuming that I have an idealized .mxd TOC structure with group layers that contain group and subgroup layers which have the same name like in the following example: Layers GroupLayer1 ...
0
votes
2answers
59 views

Switching from Nested Search Cursors to Dictionaries

I'm working with a table that has in excess of 800K records and my method of using nested cursors is not practical. I've been reading and it looks like I should switch to dictionaries, but after much ...
1
vote
1answer
34 views

Forcing users to select input from specific geodatabase using ArcPy?

I am trying to write an ArcPy script tool to simplify the spatial join tool for users. In particular, I want to: 1) Let user choose the target feature class. 2) Let user choose the output feature ...
0
votes
1answer
24 views

Batch clipping rasters using ArcPy?

Am trying to clip multiple rasters but getting a runtime error, what could be the problem with my code import arcpy, os arcpy.env.workspace = r"E:\Geos4s\GeoS4S Module Geospatial Support for Arid ...
1
vote
0answers
16 views

Extracting image attachments from geodatabase with image names according to attributes in certain field using ArcPy?

I have data from the field survey using Survey123 for ArcGIS in the geodatabase format. I want to extract all attachments from the geodatabase. I want the name of the image in the extraction to follow ...
1
vote
1answer
16 views

Add vertex into polyline at an interval

I am using ArcGIS 10.2 version and I have polyline features, for this I have to add vertex at some distance (10mtr) and label the z value of that vertex. so is there any tool or script available.
1
vote
0answers
14 views

Jump to specific folder in catalog pane using Arcpy

I am developing a Python add-in for ArcGIS Desktop. As a part of this add-in there is a button that I would like to jump me to specific folder in the Catalog Window. Is there any way to do this?
0
votes
0answers
25 views

Python script for raster compression settings (LZW) not working in ArcGIS Pro

I am processing .tif raster files in an arcpy script that converts a mosaicked tiff into a grayscale image. As the input raster InputRaster file is a mosaic and quite large (uncompressed size around ...
2
votes
0answers
24 views

ListDatasets() returning empty array on sde workspace

I am trying to get list of datasets within sde connection.This sde connection is already present in ArcMap and all datasets are visible. I am posting snapshot my code. It is returning empty array,...
0
votes
2answers
32 views

Using cursor.next() is resetting “row in cursor” causing it to skip every other row

I'm trying to update a column based on the value in the next row, but cursor.next() is giving unexpected behavior. When I identify the next_row using cursor.next(), it is resetting my row in cursor! ...
1
vote
1answer
13 views

arcpy Select_analysis where_clause objectid [closed]

Trying to copy features from sde to fgdb but only when the objectid is below a certain number. outpath = r'C:\Users\CHOK\Desktop\SDE Conversion Project\TEST.gdb' query = '"objectid" < ' + "'121'" ...
1
vote
1answer
16 views

ArcGIS Pro geoprocessing tool parameters - default settings

I would like to set my ArcGIS Pro geoprocessing tool parameters to a default value for repeated routine update cycles. The primary tools I'm using are "Create Vector Tile Package" and "Create Mobile ...
-1
votes
1answer
25 views

Mass Updating to Move Points to New Location using ArcPy? [duplicate]

I have updated x,y for about 50,000 points. How can I move the points to their new location at once (not one by one)? I know there is a way of creating a new .shp from updated x,y but that won't ...
2
votes
1answer
30 views

Checking for the existence of a workspace (arcpy), issues with if else statement

I am trying to describe, list, and test for existence of featureclasses in a geodatabase using the following code. import arcpy #Set geoprocessing environments arcpy.env.workspace = "C:"" #Check if ...
1
vote
1answer
13 views

Replace ArcGIS service files while scripting into the server

I have an ArcGIS service into my Portal (10.3), also I have an script that replace directly into the database where those files are stored. The problem is that when I run the script I see a blend of ...
1
vote
0answers
21 views

arcpy.da.ListSubtypes returns empty IOError on 64bit

I'm trying to use “ListSubtypes” function in ArcGIS Python. It works on 32bit environment (f.e. - Desktop), but it does not work in 64bit (f.e. - Server) and returns IOError without any information –...
1
vote
1answer
21 views

Add point to shapefile / “IndexError: tuple index out of range”

I'm trying to add to a shapefile a point that is a (x-y) distance away from another point (city). None of the cities in the shapefile have x-y coordinates in the attribute table; I've added them for ...
1
vote
2answers
39 views

Collapse points onto route, get distance of each point from start of route

I have a polyline SHP (with only one feature) that I have converted to a route using arcpy.CreateRoutes_lr(). I have a separate points SHP that is spatially scattered about the line. I want to "...
-1
votes
1answer
19 views

Insert a point into feature class based on another point [arcpy] [closed]

My assignment is to insert (using insertCursor) a new city at 0.02 decimal degrees east and 0.03 decimal degrees south of another city. The cities shapfile did not originally have x-y coordinate ...
1
vote
1answer
33 views

ArcPy rollback update / insert cursors if error occurs

Is it possible to rollback an update made with an update cursor or an insert made with an insert cursor if an error occurs? I need to go through a feature class and break numbers up into 100 groups. ...