Questions tagged [arcpy]

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

799 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
133 views

Reading feature class attributes with or without quotes in ArcPy?

I'm working on a script that clips a batch of feature classes by a selection made in another feature class. The way it works is by reading the clip feature fields, then allowing the user to select the ...
2
votes
0answers
139 views

Counting Subdatasets in GRIB using ArcPy?

I'm trying to utilize the extractSubdataset_management tool on a large set of GRB files. Each GRB file has a different number of subdatasets. Is there any way to execute this tool on all subdatasets ...
2
votes
0answers
460 views

arcgisscripting.ExecuteError: ERROR 001270: Consolidating the data failed

I am working on PuTTY and trying to create service definition file in server. My Python script is creating .sddraft but I am receiving 'Consolidating the data failed' error when I run stage service ...
2
votes
0answers
185 views

Arcpy.sa NoData issue with saving TIFF

Similar to Reclassify raster values of 9999 to NoData, leaving all other values alone, in ArcGIS Desktop?, I am attempting to convert numerical NoData values to actual NoData cells. The solution in ...
2
votes
0answers
469 views

Using the 'Mean' mergeRule with a spatial join

I have two feature classes. The first is a point file, derived from a raster, with the values for slope of the terrain. The second is a shapefile of polygons. What I want to do is spatially join the ...
2
votes
0answers
85 views

Spatial Analyst tools adding extra column of NoData

I've got a script tool in ArcGIS that runs Curvature and Aspect from Spatial Analyst, and the outputs of both contain an extra column. I've attempted to set the extent in the both the tool and the ...
2
votes
0answers
392 views

Arcpy script for summing pixel values in loop can't handle large number of rasters

I want to sum the pixel values of large numbers of rasters of different extents (ArcMap v10.2). 16GB RAM. I have the following code (with help from this site) which solves the different extent ...
2
votes
0answers
745 views

How to convert a raster file (*.tif) into a composite geodataset by using Python in ArcGIS 10.2.1

I created geotiff rasters (approximately 6000 rasters) in .tif format by using Matlab Mapping Toolbox. When I examined the properties of the data, I realised that it is 64 bit double type. I need to ...
2
votes
0answers
228 views

What can I use to calculate drive times /with/ traffic considered?

I am looking to obtain drive times for a large list of addresses and want the results to take traffic conditions into consideration. For example, drive times from a distribution centre to a store at ...
2
votes
0answers
301 views

A list of layer names that you want to be turned off when Layers name are in Right to Left Such as persian

When I ran this code I got "UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal" error I don't know why I tried many way but I ...
2
votes
0answers
2k views

Returning distances in meters from Near (Analysis) tool of ArcGIS for Desktop?

I'm trying to write a python program that returns the distance from each point in a set to the nearest road. Specifically, I was looking for any points within 10 meters of the roads. Both sets of ...
2
votes
0answers
382 views

Converting KML To Layer using ArcPy losing objects?

I am trying to a convert kml file to a layer using python. This is my code: import arcpy arcpy.KMLToLayer_conversion('C:\kml\\result.kml', 'C:\kml', 'result') But the layer has lost a lot of ...
2
votes
0answers
100 views

Using arcpy.StackProfile_3d within arcpy addin

I want to get elevation profile in ArcScene using arcpy. Specifically, I want to create tool used as follows: click tool button, draw line interactively and output a graph presenting elevation profile....
2
votes
0answers
229 views

Convert Arcpy results to feature class in ArcMap 10.1

I am using ArcGIS 10.1 and am a newbie in Python. Currently we are executing stored procedure (from sql server) through ArcPy in ArcMap. I want to create feature class from executing following python ...
2
votes
0answers
457 views

Is there a way to test if a feature class is registered with geodatabase?

I've got feature classes inside an Oracle 11g ArcSDE geodatabase. I'd like to perform the arcpy method RegisterWithGeodatabase_management on all those feature classes. But before that, I'd like to ...
2
votes
0answers
277 views

Data loss after compressing geodatabase in ArcSDE

I suffer sometimes from data loss after compressing ArcSDE geodatabase, this geodatabase contains versioned feature classes, so the compressing script reconciles and compress the geodatabase: # ...
2
votes
0answers
842 views

Finding coordinates from nested grid as numpy array?

I've written a script that allows a user to read in a raster and provide a cell resolution, and outputs the amount of cells necessary to resample the grid (to provide a pre-processing tool to run the ...
2
votes
0answers
181 views

Obtain virtual output directory path in geoprocessing service

I am publishing a geoprocessing service and I want to be able to access the virtual output directory path configured for the service. Now I know that gp services will magically return virtual paths ...
2
votes
0answers
50 views

Generating composite values ( MAPFID numbers) for previously duplicated vales based on 2 different fields

Good day everyone! I have lurked around here for info preiously, but this is my first post, so please be gentle if I commit any faux pas. Okay, let me try to break this down so we can all understand....
2
votes
0answers
75 views

Copying an entire column between layers (tables)

I have a raster layer with probabilities as values and I process them using the Spatial Analyst extension. After the processing the values are modified, however I would like to also have the original ...
2
votes
0answers
736 views

Cost Path tool in script randomly throws error

I have a script tool that is creating a least cost path for sets of points using a Cursor. When applied, the script runs great, except every so often the tool is stopped because there is an error in ...
2
votes
0answers
433 views

Different results from Spatial Analyst GP Tool and Python

I am writing a script that has to subtract one raster from another. The rasters I have represent 1) Parking Lots (1 = Parking Lot, 0 = not Parking Lot) and 2) a buffer around the Parking Lot (1 = ...
2
votes
0answers
1k views

Why does Clip analysis generate (some) empty output?

I am running a script that is working (see below) - it pulls a file from a folder, clips from that file based on an intersection with another file, and creates a new shapefile in a new folder. It has ...
2
votes
0answers
598 views

Can not get text element to update?

I can not get text element to update? Text ELement has been added "Subdivision" Still not updating?.. class ButtonClass2(object): """Implementation for FemaMapper_addin.button (Button)""" def ...
2
votes
0answers
217 views

Problem to transform events from one route to another

I have a road feature class layer containing parts like 1_10, 1_20. 2_10, 2_20... etc. 1_, 2_ is later used to create the route and _10, _20 is indicating the direction (the road feature classes were ...
2
votes
0answers
419 views

ArcGIS/arcpy: Geometry object comparison methods not working. Do they take z values into account?

I have an arcpy script that makes calculations based on an input PolygonZ feature class. What I need to do in several places in the script is test whether a point falls within a polygon in 2D. In ...
2
votes
0answers
114 views

network related issues arising when running an arcpy script

Essentially I wrote an arcpy script that is within a toolbox that I ported over to a different machine to test out after the script worked locally. The script essentially utilizes the psycopg module ...
2
votes
1answer
271 views

Extracting raster using values in ArcPy?

I have an original .tif file which has values ranging from 2 to 28. From that original .tif file, I am extracting cells having a value of >=10 using the following code: import arcpy, os from arcpy ...
2
votes
1answer
520 views

Create Map Tile Package (tpk) progress? arcpy.CreateMapTilePackage_management

I'm using arcpy.CreateMapTilePackage_management to happily create a .tpk - all good. Trouble is this can take a matter of hours, or days for a large complex mxd, once arcpy....
1
vote
1answer
19 views

Error calculating field with script exported from ModelBuilder

I am attempting to add a new field called "TimeYrCode" to a list of shape files, and then add values to this field based on the value of the "gridcode" attribute, which represents different days of ...
1
vote
0answers
20 views

Create .lyr file from open .mxd layer without removing layer

I have a tool that is meant to clip and reproject every layer in an open .mxd, and then create a new feature class and .lyr file with original symbology from the result, not adding either to the .mxd. ...
1
vote
0answers
17 views

Exporting groups of PDF based on Orientation

I am trying to create a map book with two different orientations. The part I am currently stuck on is for the loop to go through the table and export groups of the same orientation. an example of the ...
1
vote
0answers
37 views

Labeling layers using ArcPy

I have a point layer from an imported shapefile that I am trying to label automatically with arcpy. I had hoped that a simple: def update_labels(id): import arcpy mxd = arcpy.mapping....
1
vote
0answers
17 views

Generate tiles when creating tile Layer on ArcGIS Enterprise Portal

I have a raster (TIFF) that I want to publish on my ArcGIS Enterprise Portal. To reach that aim, I followed these steps : 1) Create SDDraft from TIFF in ArcGIS Pro project 2) Create SD file from ...
1
vote
0answers
32 views

Creating tool in ArcGIS Pro that takes parameters from users (e.g. geodatabase filename) and shows report on screen

Yesterday, I got a help from this website and wrote the following code to create a new script with a hard-coded geodatabase filename, that lists the feature classes it contains to the console. ...
1
vote
0answers
32 views

ArcGIS Python Add-ins Password Input

I am working on a ArcGIS Python Add-ins which need user login to get data. Rather than exposing user's password in a combobox forever, we need to have a password input box which only show * while user ...
1
vote
1answer
62 views

Python Toolbox Value Table values and list inputs

I am trying to create a Value Table I will use to create a field mapping object. First column will represent the target field, second column carries the source field. The first column is populated ...
1
vote
1answer
45 views

Copy feature class from multiple gdb to a single gdb

I need to write a Python script that is copying. I want to copy a common feature class of these gdb to a single gdb import os import arcpy arcpy.env.workspace = ("D:/Planchas") workspaces = arcpy....
1
vote
0answers
16 views

SWITCH_SELECTION, CalculateAreas_stats and ARE_IDENTICAL_TO not behaving as they should be in ArcPy

I want to select features by location using "Are identical to" method and then want to switch the selection so that I have only the features that have been edited or newly created. Then I'll select ...
1
vote
0answers
41 views

Calculate field with a value in a list based on field

I didn't want to write an if statement for every field. I wanted to know if there was another way to field calculate each field with the values related to it in this example table. Fields (X,Y,...
1
vote
0answers
39 views

arcpy.mapping.UpdateLayer returns runtime error

I am trying to update the style for a layer present in my saved map document with a source .lyr file present on my disk in the home folder. It returns an assertion error. The code I am trying to run ...
1
vote
0answers
31 views

Calculating NDVI using ArcPy

I have a custom function that I'm trying to write (using Arcpy in ArcGIS 10.7.1), but I'm having a little trouble writing a successful function because I'm new to custom function writing. I want the ...
1
vote
0answers
51 views

Tool Script for Geojson to Shapefile

I am creating an Arcmap tool script that takes user input and then takes a geojson file from a specified folder and then opens it into Arcmap as a shapefile. The issue I am running into is that I am ...
1
vote
0answers
21 views

ArcGIS Pro PostgreSQL SSH connection string

I am involved in a project where a SQL Server-base application is being retired and replaced with a PostgreSQL/PostGIS-based tool under development. There is a large amount of cross-checking to be ...
1
vote
1answer
37 views

Exporting webmap into PDF without layout using ArcPy with ArcGIS Pro

I try to export a webmap in using arcpy into a pdf. This works fine, if there is a Layout available using: aprx = arcpy.mp.ConvertWebMapToArcGISProject(webmap, None, None, notes_gdb) aprx....
1
vote
1answer
30 views

Framing argument for insert cursor when writing geometries using ArcPy?

I am writing polygon geometries and I have points holding the geometries that represent vertices of the polygon. When I run the code below I get: TypeError: sequence size must match size of the ...
1
vote
0answers
36 views

Error in ArcPy script building network

I am trying to use the network analysis toolset to build a route. I made the the tool in model builder initially and have tried to edit it to make it a script. When I try to build the network I get ...
1
vote
1answer
25 views

Arcpy Clip Raster not setting clipped out area to NoData

I have an 8 bit raster that I'm clipping using arcpy 10.7 arcpy.Clip_management("inrasPATH","","outrasPATH","PolygonPATH","256","ClippingGeometry","MAINTAIN_EXTENT") However whenever I clip the ...
1
vote
0answers
18 views

arcpy.RemoveAttachments_management doesn't remove all matched attachments

ArcMap 10.5, referred doc: http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/remove-attachments.htm I created a tool for users to attach files to the selected objects in ArcMap. ...
1
vote
0answers
40 views

Can't run 3D Analyst extension in custom script tool

I have custom python script in which I use 3D Analyst function "Add surface information", it works fine when I run the script through ArcCatalog Python Console, but when I try to run the script as ...

1 2 3 4 5 16