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
2answers
45 views

Using SearchCursor and ArcPy to add message?

This Validates that all Polygons have a map unit. verify that the absence of a Map unit is caught by the check... here we test for the empty string or the python "None" type. Verify that this is how ...
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": "...
0
votes
0answers
19 views

ArcGIS RuntimeError: Not signed into Portal [duplicate]

I'm running ArcGIS Pro Python IDLE and getting an error that says: RuntimeError: Not signed into Portal. This happens no matter how many times I run the script. I looked at my ArcGIS administrator to ...
2
votes
1answer
70 views

Getting ExecuteError: ERROR 001558: Error parsing JSON file in ArcPy?

I'm trying to convert some open-source data in JSON format to a shapefile for use in ArcGIS Desktop. I'm attempting to do this in ArcPy with ArcMap 10.7. The data I'm trying to access is here, in ...
-1
votes
1answer
60 views

Changing fifth line of text using ArcPy?

Subsequent to Changing second line text using ArcPy?, I want to know how can I change the fifth line from 'aaa' into 'plan b' so the result will be: with this code, by using index operator [5] ...
2
votes
2answers
66 views

How can I create an inset map in DDP that zooms to a feature in a layer besides the index layer?

(ArcMap 10.6.1) I have a map that is using DDP to index through and show ~1800 short line features (bridges), and I need the map to be pretty zoomed in because I'm wanting to show the immediate ...
0
votes
1answer
27 views

Making dropdown in ArcMap tool where each item links to spreadsheet?

The script below imports a spreadsheet into ArcMap and generates a shapefile. Currently, I can use the ArcMap tool that interfaces with the script to navigate to the spreadsheet I want to import. This ...
1
vote
1answer
30 views

Updating gdb with JSON?

parcelsFC = os.path.join('temp.gdb',JsonDirectoryLocation) arcpy.JSONToFeatures_conversion(parcelsFC) Created gdb with above code. How can I add attributes to gdb with another JSON file?
3
votes
2answers
78 views

Saving Python objects into memory for repeated use of Python toolbox?

I have made a Python toolbox which processes relatively large polyline feature class (millions of features), builds a network graph from it as dictionary of lists, and depending on user selected ...
1
vote
1answer
33 views

Deriving field parameter from table parameter in Python Toolbox?

I'm trying to derive a Python Toolbox parameter from another parameter. I'd like to have a tool which determines fields from an input table and applies the list as a filter to a second parameter. This ...
1
vote
2answers
42 views

Performing Union_analysis on outputs created with arcpy.GetParameterAsText()?

I am trying to write a script tool for my geospatial programming class and I am stuck (this is an online course and we get NO support from our instructor). What I need to do is create buffers (...
4
votes
1answer
65 views

Limiting Input Parameter to only File Geodatbase in Python Toolbox?

I've been working with ESRI Python toolboxes for a while but I'm still having difficulties setting an input parameter as a "DEWorkspace" and using the parameter filter to make it so only file ...
-1
votes
2answers
59 views

Updating Z coordinates of points in polygons with ArcPy

I am trying to update Z values of polygon shape with ArcPy. This script is working without error but increasing the first (0 position vertex) vertex twice. I want to update only once. How can I avoid ...
0
votes
1answer
53 views

Getting same result with less code with PythonWin ArcPy? [closed]

I have finished writing code and it does what I need without having any error. However, I am wondering if there is any option to get the same result in fewer lines, pecially the for loop inside the ...
0
votes
1answer
1k views

TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and 'numpy.ndarray'

I am trying to insert a value for different group of percentile eg (0- 10 percentitle) value = 1. I saw an example over here and went to try it out How do I Calculate Grouped Percentiles or Batch ...
0
votes
1answer
41 views

Checking to see if database is there and delete if so using ArcPy?

I am looking for my python code to check for the polycheck.gdb and if it is there delete and create a new one. Also, I would like to set my workspace to that database. Not sure if this is the right ...
0
votes
0answers
15 views

Automate simple kriging of multiple fields from the same shapefile using ArcPy?

I'm trying to interpolate temperature data that's in multiple fields of a shapefile automatically using ArcPy. It doesn't sound like a difficult task but I'm new to both ArcGIS and Python, so here's ...
0
votes
1answer
41 views

Creating Select Then Zoom Tool using ArcPy? [duplicate]

I have been trying to create a tool to make a simple select then zoom to selected but I've been running into some issues. I've been using the code from this original posting (https://community.esri....
1
vote
0answers
77 views

Adding points in existing profile graph with labels of its heights using ArcPy? [closed]

I have created profiles at multiple locations with lines. Now I want to add points to that graph, how do I do that? Here is the script: import arcpy import os import matplotlib.pyplot as plt ...
0
votes
1answer
195 views

Using ArcPy to display xy data gives ERROR 000212?

I have a table (.dbf table) and I need to display on map its values. In this table I have fields: Value to display, longitude(at meters), latitude (at meters). When I right click in this layer and ...
3
votes
2answers
2k views

Error 000212 Cannot create XY event source from arcpy.MakeXYEventLayer_management?

I am using ArcPy to create an output feature layer. I am using the command: arcpy.MakeXYEventLayer_management(wells, "longitude", "latitude", wells_layer, GEOGCS, ""), where wells is my input csv ...
0
votes
0answers
26 views

Changing NODATA value GeoTIFF with ArcPy of ArcGIS Pro?

I'm using a tool in ArcPy for Python 3 (ArcGIS Pro) which applies an operation to a raster file in GeoTIFF format. condicion = '("{}" - {}) / {}'.format(input_image,n,m) arcpy.gp.RasterCalculator_sa(...
0
votes
1answer
76 views

Getting 'list' object has no attribute using ArcPy for ArcGIS Pro? [duplicate]

I am using ArcGIS Pro with Python 3.6. I'm posting this as a new question because I've made significant headway in narrowing down the problem. I believe the issue is how ArcPy is used with ArcMap ...
0
votes
1answer
41 views

Trying to print 10 separate PDFs using ArcPy but overwriting same PDF file?

I am using ArcPy with ArcMap 10.5. I have a written a script that reads an Excel file, plots the X,Y points, creates heatmap rasters, and prints them to PDF. The broken part is that the PDF is ...
1
vote
0answers
24 views

Layers being removed erroneously at Python script tool finish? [closed]

I've got two Python scripts as a tools in a standard toolbox, and when the tools finish they will sometimes remove a layer from the MXD. It is most likely to happen on the first run of the tool ...
5
votes
3answers
9k views

row.getValue() doesn't work but row[1] does

for some reason I can't get row.getValue to work properly... my script will only work if I use row[0] and get the value manually but I am sure the location/order of my fields will change from dataset ...
1
vote
1answer
2k views

Zooming to selection in arcpy.mapping and only seeing selected features?

I selected data by using select layer by attribute, then I need to only select these selection and zoom in to the selection. my code is this, it can zoom in base on the scale I set, but I see other ...
1
vote
1answer
225 views

Doing definition query on layer and zooming to it using arcpy.mapping?

I am trying to do definition query to a layer and to zoom to the same layer, but I got an error ("SyntaxError: can't assign to operator") ?? dataFrame = arcpy.mapping.ListDataFrames(mxd)[0] # the ...
5
votes
2answers
6k views

Copying selected (targeted) features to new shapefile using ArcPy?

I am trying to copy specific attribute table rows from one shapefile to a new shapefile that will contain only the specified rows in its attribute table, that is, if a field GDP_TOP10 = 1. I am ...
0
votes
0answers
39 views

Updating Symbology on Layer using ArcPy?

I've been trying to update the symbology of a layer on my Python script. The layer that is to be updated shows the percentage of an age range in each region across a county. I have created a test ...
4
votes
2answers
1k views

Transforming ArcGIS date field to integer?

I have a featureclass with a 'date' class field named 'ACQ_DATE' formatted as: 1-8-2013 24-7-2013 etc. As you can see the number of digits is not harmonized. I want to display the dates on a ...
0
votes
0answers
17 views

Error Projecting Raster (.hdf) Using ArcPy

I want to project HDF files (MODIS images) to another coordinate system using ArcPy. The following is the code I wrote: input_ras="N:\\mod16a2\\MOD16A2.A2001001.h24v05.006.2017068142418.hdf" out_ras=...
0
votes
1answer
53 views

Update Z values of polygon veritices with multiparts and donuts [duplicate]

I am trying to update Z values of the vertices of the polygon shape. The script bellow works for polygons without multiparts and donuts. If I run this script for polygon shape that contains multiparts ...
3
votes
3answers
167 views

Programmatic logic ArcGIS uses to determine added fields from geoprocessing when inputs have duplicate field names

ArcGIS has a confusing method for updating field names when combining tables with duplicate field names. For example, I have two tables containing the field Id. If I run JoinField_management, ...
3
votes
1answer
125 views

Masking LiDAR points to create DEM in ArcGIS Pro with ArcPy?

I have an irregular LiDAR point cloud dataset, so when I try to create a DEM or DSM, the points are connected across the irregular edges of the LiDAR point cloud. I thought that creating a mask ...
0
votes
0answers
18 views

Maintaining attributes in feature class in memory using ArcPy? [duplicate]

i am trying to feature to line conversion that are not multipart lines and Merge output feature class but its loses the attributes. Here is my code: arcpy.env.workspace="in_memory/" with arcpy.da....
1
vote
1answer
33 views

ArcPy search data from a list of values

I have a list WRL_ID = ['NW-E8-105151', 'NW-E8-105138'] and I am trying to search these values in a field called ID. If the value exist, print 'It's in SDE', if not, print 'Not in SDE'. Right now ...
0
votes
0answers
36 views

Assigning correct extent in create constant raster tool in ArcPy?

In my script I am creating a constant raster using the adjusted extent from a another raster (out_point). For my further calculations I need the center of all raster cells laying on integer ...
1
vote
1answer
24 views

Joining feature classes defined in list to dbf tables which defined in another list using ArcPy?

I am trying to join feature classes in a list to tables in another list using a join field which is the same for all joins. In general terms, I want to join the first feature class in the list to the ...
3
votes
1answer
730 views

Using directory names starting with number in ArcPy?

I have a script to export DDP extents to tif and when I change arcpy.mapping.ExportToTIFF(mxd,"tests\BA\BA10k_" + str(ddp.pageRow.PageName) + ".tif",df,9306,9306*ar,1800,True) to arcpy.mapping....
0
votes
0answers
16 views

Retrieve WMX Database folder using ArcPy?

By using 'WMXAdvancedSettings.exe', the user can modify/change the default Database folder path(jtc-file path). In such case, how can I find the "WMX Database folder path" from current settings by ...
2
votes
1answer
794 views

Python script (ArcPy) crashing one machine, but works on others? [closed]

I have been woking on a script that will select parcels that are within a particular ArcGIS 10.1 data driven page, create a list out of those parcels, and then populate a text element within my MXD ...
1
vote
1answer
52 views

Updating Z values with geometry of multipart and donut polygons with ArcPy?

I am trying to update Z values of polygon features with point features. The code is (found on GIS Stack Exchange) working good if no 'interor ring' or 'multipart' features are present in the polygon ...
9
votes
1answer
620 views

Do ArcGIS Pro tasks support Python Toolbox tools which operate on Map Frames?

Do ArcGIS Pro tasks support Python Toolbox tools which operate on Map Frames? The reason I ask is that I am stuck when trying to do the following: Start ArcGIS Pro 1.1.1 Create a new project - I ...
2
votes
1answer
32 views

Finding documentation for changes to syntax/parameters of ArcPy tools/functions in ArcGIS Pro? [duplicate]

In a Q&A on this site I recall @KHibma pointing out where in the ArcGIS Pro Help any changes to the syntax (like extra parameters) of a particular tool/function since ArcGIS Pro 1.0.0 could be ...
2
votes
1answer
89 views

Installing ArcGIS Desktop on web server?

I am working on a spatial tool that we do not want to publish as a geoprocessing service due to certain organizational needs; instead we are publishing up a .NET MVC application that calls a Python ...
0
votes
2answers
210 views

error on arcpy.FeatureSet() load from feature service: cannot open table for load

I am trying to pull data from a feature service into a feature set, and the following was working perfect: fsURL = baseURL + query fs = arcpy.FeatureSet() fs.load(fsURL) but all of a sudden, this ...
0
votes
0answers
26 views

Invalid expression in SelectLayerByAttribute?

I am coping with a shapefile and I want to select some rows if the values in one column are in a Python list. The following gives the code I write: tpu_involved = list(set(dataframe['SmallTPU'])) ...
1
vote
1answer
1k views

Which is the faster way to copy data to another feature class: Feature Class to Feature Class or Insert Cursor

I have a feature class with 1 million records. Which is the faster way to copy data to another feature class: Feature Class to Feature Class or Insert Cursor?
1
vote
1answer
55 views

Creating heat map animation based on point-shapefile with data attribute in ArcGIS [closed]

I want to create an animation of forest fires, using the NASA' MODIS data for the last 11 years. Their shapefile has acquisition data attribute — and it goes day by day all those years. I've already ...