Questions tagged [arcpy]

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

720 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
286 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
370 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
97 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
226 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
223 views

Create custom raster pyramid using arcpy in ArcGIS 10.2

I have a arcpy script that runs the Point Density tool several times for the same extent, using the same number of neighborhood cells, but with cell size increasing at an multiple of 2 with each pass. ...
2
votes
0answers
424 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
274 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
837 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
176 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
732 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
426 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
597 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
216 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
208 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 ...
1
vote
0answers
44 views

Field Mappings control doesn't show the Add Input Field in the context menu of a Python Toolbox

I’m trying to build a Python Toolbox which uses a Field Mappings control (GPFieldMapping parameter). For some reason I don’t manage to get the same behaviour of the Field Mappings control as in the ...
1
vote
0answers
25 views

arcpy.Integrate_management failing?

I cannot get arcpy.Integrate_management to work. I can run as a standalone process in ArcMap just fine, and if I copy the result as a python snippet I get: arcpy.Integrate_management(in_features="...
1
vote
0answers
21 views

Updating text elements not working when using APRX path vs “CURRENT”

I am beginner in ArcGIS Pro and I am trying to expand into using python with ArcGIS Pro. I have a working script that will update a specified text element in all layouts in ArcGIS Pro, in my case it's ...
1
vote
1answer
21 views

Using two Python Addin Combo Boxes to choose Folder then Layer

I am trying to create a Python add-in for ArcMap for users to quickly select layer files from within several different folders. This will require 2 combo boxes. User selects the folder from the first ...
1
vote
0answers
30 views

Using ArcPy.AsShape results and converting them to feature class?

I have a GeoJSON that I'm trying to convert to a feature class or shapefile using ArcPy. The original GeoJSON is taken from a web link here: geojson Here's a sample of the GeoJSON: { "type": "...
1
vote
1answer
48 views

Conversion of Landsat ToA reflectance to BoA reflectance with an equation

I am using temporal datasets from Landsat 5, 7 and 8. Since I have many datasets I would like to include the conversion from ToA(top of atmosphere) to BoA(bottom of atmosphere) reflectance into a ...
1
vote
1answer
75 views

Comparing a polygon layer within the boundary of a polygon

I'm pretty new to ArcPy and Python. In our database, we have a layer containing parcels (polygons) with a neighborhood code and a polygon layer that contains the neighborhood boundary. Within that ...
1
vote
1answer
21 views

Adding multiple feature classes (everything within gdb) to a group layer in ArcGIS Pro - Python

I am currently trying to add all the feature classes contained within a gdb to a group layer in ArcGIS Pro via a script. I have however not managed to add more than one single feature class at a time. ...
1
vote
0answers
28 views

Raster calculator giving different results in ArcPy than in ArcGIS?

I have two rasters representing travelling speed: one for road (with speed values for different types of roads and "0" values where there is no roads) and one for land-cover (with lower values, but no ...
1
vote
0answers
42 views

Importing/downloading symbology from ArcGIS Online using ArcPy?

I am currently attempting to create a script to download shapefiles from ArcGIS Online to my local drive before adding it to an aprx project and thereafter uploading it to a ArcGIS portal/enterprise. ...
1
vote
0answers
54 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....
1
vote
0answers
34 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
1answer
49 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
0answers
43 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 ...
1
vote
2answers
48 views

Python upload to service fails in FME but works in ArcGIS

I have added a shutdown Python script to my FME workbench to publish the TIFFs written as a service. import fme import arcpy AGSconnection = "W:\\Entity\\ABZ\\myfolderpath\\gbepabz-file.name.ags" ...
1
vote
0answers
28 views

Performance degradation in arcpy.mapping when setting text elements

I'm generating a map book of about 300 pages using arcpy, instead of using the toolbox, because I need to do a bunch of scripted actions - on each page I'm setting the extent and rotation of 3 ...
1
vote
0answers
44 views

Cannot set input into parameter error on second iteration

On the second iteration of the loop starting line 7 I get the following error. Everything works as intended on the first iteration. Any ideas on why this is failing the second time around? Error: ...
1
vote
0answers
54 views

Setting color assignment order with ArcPy?

I have a shapefile feature class with the following attribute table: I set the shapefile symbology using these lines: lyr.symbology.valueField = "GRIDCODE" lyr.symbology.addAllValues() What i get ...
1
vote
0answers
31 views

Error 000445 in iterate Resample for rasters in Arcpy

I'm trying to resample rasters using a foor loop. Something is going wrong but i don't know what... This is my code: import arcpy, os, math from arcpy import env from os.path import split, join from ...
1
vote
1answer
128 views

How to delete temporal files from geoprocess tools using Python ArcPy?, ArcMap10, ArcGis

As is not possible formulate, or add a solution to question: Delete temporary files from geoprocessing in ArcGIS 10 and above , because is [closed] I would like to make this question with same ...
1
vote
0answers
20 views

ArcGIS Pro Unable to Pairwise Intersect Point with Polygon?

I am trying to create a point from XY coordinates then use Pairwise Intersect to determine the corresponding parcel. The intersect is not returning any values. Any thoughts on the error in this code? ...
1
vote
0answers
29 views

Using ETGeoWizard functions in ArcPy?

I have ETGeo Wizard license and I would like to run the functions via ArcPy instead of running them in ArcMap. However, the functions works in ArcMap but not in a script. one of the example is ...
1
vote
0answers
30 views

Executing Select Layer By Attribute in Python Add-in Toolbar (ArcMap)

I'm having trouble with the button class of my code: class OKButton(object): """Implementation for ok.button (Button)""" def __init__(self): self.enabled = True self.checked = False def ...
1
vote
0answers
86 views

Installing third-party Python Packages to Work With ArcPy and ArcGIS Pro?

My employer does not grant me permissions to use Python package managers like pip or conda since the websites that host these data are blocked. In ArcMap 10.x I have been able to install third-party ...
1
vote
0answers
29 views

Describe FeatureClass shape type, can't get past error (object has no attribute 'shapeType')

My code: import arcpy, csv, os # Create a Describe object gdb = r"Database Connections\GISUSER.sde" desc = arcpy.Describe(gdb) full_path = False # Specify whether dataset name should be full or ...
1
vote
0answers
30 views

Hosted Feature Layers to local gdb and maintaining history in feature class?

Situation: I have setup a python script that writes fire equipment features from AGOL to a FGDB. These features are updated on a weekly basis using Collector. Script: ================================...
1
vote
0answers
40 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 ...
1
vote
1answer
35 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
0answers
20 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
0answers
65 views

Accessing additional CAD annotation fields

I'm trying to read certain values from the annotation layer of a CAD file (MicroStation.dgn). It seems like for certain entities (Cell) the text isn't stored in the field 'TxtMemo' or 'Text'. When I ...