The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
votes
1answer
640 views

Script Convert KML to Layer [closed]

I have a KML file (https://meocloud.pt/link/a60a4408-0b89-4163-9a4d-c91c181bbab4/ROI.kml/) and I want to convert to SHP in ModelBuilder using this script that I found on-line, but it doesn't work. Can ...
-1
votes
1answer
715 views

Draw Line from Point to existing Line

I am working on a water network, I want to draw a House Connection pipe from a house meter to nearest existing water line, I tried using python script, I could just find the nearest line. I also want ...
-1
votes
1answer
72 views

I want to reclassify a raster in one folder, rename it and put it in new folder using Python

I've been combing stack exchange and I cannot figure it out. I have a raster "slope_tif_18TXK030910", I want to reclassify it, rename it and put it into a new folder. this is what I have and it works ...
-1
votes
1answer
159 views

Writing Python Code to create a Median tool in ArcGIS 10.2

I am attempting to write the code for a toll in Python that will effectively: access the city data and load it, if it isn't already in the list of layers get a country name from the user and access ...
-1
votes
1answer
149 views

searchcursor only takes first value in field

My script ArcGIS 10.2 is using the searchcursor to read the mLanduse feature class to return the value in lField, but it is only returning the first value in lField to populate the sField in mSoils. ...
-1
votes
1answer
352 views

A script that only deletes fields within an attribute table specified by the user [closed]

I would like a script that will be executed in ArcGIS that only deletes fields within an attribute table that are specified by the user. As I understand it, this can be done in Modelbuilder but was ...
-1
votes
1answer
360 views

Rewriting VB codeblock as Python for ArcGIS Field Calculator?

I am looking for assistance to rewrite my VB codeblock into Python. Im on Win7, Arc10.2 and Python 2.7 The code below works fine for me, I am simply looking to port it to Python so i can progress down ...
-1
votes
1answer
181 views

Understanding Python / ArcPy code? [closed]

I am looking for a walk through of the Python code below to explain how it works in ArcGIS. #import modules import arcpy, os #set env arcpy.env.overwriteOutput = 1 ws = r"C:\TestData\Far\...
-1
votes
2answers
2k views

SelectLayerByLocation - arcpy

I have 2 layers: "atikot" and "ways" that located in C:\Project\layers\New File Geodatabase.gdb , and i try to use this code based on "ArcGIS Help 10.2" to select features from "ways" layer: import ...
-1
votes
1answer
52 views

Cannot see added layer in Table of contents arcgis

I am using a Python script to add a layer to my mxd. Following is the script: mxd = arcpy.mapping.MapDocument(r"C:\Amruta\clustereddata.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] print ...
-1
votes
1answer
167 views

Determining if polygon contains point to populate point's field with polygon's name using arcpy.da?

Am trying to check if the points in a point shapefile are contained within a polygon shapefile and if so, to populate a field in the point shapefile with the name of the polygon and to populate the ...
-1
votes
1answer
163 views

ArcPy to perform “select by attribute” and display the result on the map in a table [duplicate]

I am thinking to use ArcPy to select by attribute, after that I want to display the selected features attribute in a table on the map, how can I make it?
-1
votes
2answers
3k views

Error 000368 selectbylocation in script from ModelBuilder?

Can anyone help? I created a model-has buffer,clip, selectbylocation.... I exported the model as a script but when i try to run it i get this error: Executing: IGISprogrammingscript C:\Temp\...
-1
votes
1answer
181 views

How to save a copy of the current data driven page to a new map file?

I need to copy the current data driven page to a new ArcMap Document using arcpy so that I can make sure the file name follows the naming schema that we have defined and the user cannot change. Is it ...
-1
votes
2answers
62 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 ...
-1
votes
1answer
31 views

Using Field Calculator for subtracting values with same ID in ArcPy? [closed]

I have a line shapefile that used for some calculation. One of the calculation is subtracting values with a same group ID. The shapefile has a filed called LineID that consists of 2 lines with Side 1 ...
-1
votes
1answer
36 views

Select by using ArcPy? [closed]

From the below table: If number of ID_T's counts is more than 2 then, I have to select, same ID_T but DIST value vary of minimum 10 meters
-1
votes
1answer
46 views

Making XY Event Layer into Copy Feature layer using ArcPy?

I am taking a CSV file and importing it with the XY Event feature layer. I then am trying to use the Copy Feature tool to get "Object ID" assigned to each row in order to run an attribute query. My ...
-1
votes
1answer
20 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
votes
1answer
61 views

Selected location extract data into single KMZ file or Single zip file in ArcGISServer - Python Tool GP Service

I am trying to write the GP tool (Python script), To extract the data for selected location into KMZ file, Please check below code it's executing successfully but written the incorrect zip file ...
-1
votes
1answer
48 views

More Pythonic way to loop through UpdateCursor?

I have several sets of fields to populate based on other fields. The code below works, but I am wondering if there is a more Pythonic way to march through the i,j pairs? (Actual fieldnames are not ...
-1
votes
1answer
319 views

Reading Text File to create Polyline with ArcPy?

This is carrying forward from the previously asked Creating Polyline shapefile from text file using ArcPy? With further insight from a colleague, I have the following code that I feel is a good ...
-1
votes
1answer
33 views

Removing layer from specific data frame using ArcPy gives IndexError?

I work on several maps- each map has different number of data frames (several maps had only 1 or 2 data frames). with this code i try to remove layer "frame" from the third data frame only. I want ...
-1
votes
1answer
563 views

Populating field with values based on another value using ArcPy? [closed]

How do I populate a field y with info1 or Info2 values, depending on the value of the x field, using if conditions?
-1
votes
2answers
454 views

Listing layers from .mxd file using ArcPy for ArcGIS Pro?

I am looking for a way to access a .mxd file's layer names and data sources. In ArcGIS Desktop, I could do: def print_layer_info(mxd_path): print(mxd_path + ":") mxd = arcpy.mapping....
-1
votes
1answer
177 views

Write rows from file geodatabase Table to NonGDB Table in SQL Server using Python

I have data in a file geodatabase table that I want to write into an existing table in SQL Server (not enterprise-enabled) using Python. I am already using pyodbc to read SQL data elsewhere, but am ...
-1
votes
1answer
39 views

Is there a way to list all the layers created using the arcpy.MakeFeatureLayer_Management() method? [closed]

The question I am seeking an answer to: If I make several layers with MakeFeatureLayer_Management(), is there a way to programmatically search for and list the names of the layers created? (Without ...
-1
votes
1answer
256 views

Why is Python Script (using XYTabletoPoint) Deleting target Feature Class? [closed]

When I run the following script (using Arc 10.2.2): import arcpy if __name__ == "__main__": # Get Parameters Source_CSV = arcpy.GetParameterAsText(0) Target_FC = arcpy....
-1
votes
1answer
62 views

Find number of every point of interest within radius and number of specific points of interest within radius using ArcPy? [closed]

I have two shapefiles that I am a trying to compare to one another. The first set of points are various businesses. With assistance it was discovered that in order to get a subset category from that ...
-1
votes
1answer
23 views

Is there a way to get aKML data into a feature class? [closed]

I have a couple of KML files and I need to use ArcPy to insert these KMLs into a feature class in the SDE. I’m new to ArcPy so I’m looking for advice on how to approach this. I already have a feature ...
-1
votes
1answer
49 views

Python For Loop is Adding Extra Records to Output

I'm using Python in ArcGIS Pro to run through a couple of point layers to find the Closest Facility between them. I think I'm really close to getting what I want in an output, but I'm getting more ...
-1
votes
1answer
1k views

Fixing TypeError: int() argument must be a string or a number, not 'NoneType' in Con function

I am working with DHSVM model and to create the streammapfile I need to run a code but I got the following error. Traceback (most recent call last): File "C:\Rana\PhD in U of U\Spring_2018\...
-1
votes
1answer
51 views

Finding difference between populations from 1990 to 2010 and writing info to new field using ArcPy? [closed]

I am trying to write a script that finds difference but every time I use the information from instructor, I am getting an error, and getting nowhere... table: field one is: Area_name, field two is ...
-1
votes
1answer
368 views

arcpy.CopyFeatures_management() gives ERROR 000732?

I'm using ArcGIS Desktop 10.2.2. I have a feature class in a geodatabase that from time to time I want to update with new data in an excel table. I wrote the following script to convert an excel ...
-1
votes
1answer
178 views

Python Script error in function ERROR 000539: SyntaxError

I am receiving the following error; is it a simple syntax issue with the Calculate field because I'm not seeing anything missing. ExecuteError: ERROR 000539: SyntaxError: unexpected EOF while parsing ...
-1
votes
1answer
78 views

SQL query new feature within definition within loop of cursor

I am using ArcGIS 10.4.1.5686 and running code within ArcMap. I thought that this question is similar to SQL query new feature with loop, or even Using a for loop to execute a query in arcpy, but ...
-1
votes
1answer
56 views

Python code help for ArcGIS Field calculator?

We are using Python in ArcGIS environment. I want to define a geographical vector data's field as an array and then I want to compare each field's mean average with each other To compute a new C field;...
-1
votes
1answer
86 views

ApplySymbologyFromLayer_management fails error 732 [closed]

When I ran my arcpy script from the python prompt, the ApplySymbologyFromLayer_management worked fine using just the layer names for the parameters. Same thing when running that tool from ArcMap ...
-1
votes
1answer
49 views

Select analysis tool is creating an empty feature class in an arcpy stand alone script [closed]

I'm using select analysis to find a specific value. My program is working and I'm not getting any errors. However, the feature class that the program is creating is empty. I've double checked to make ...
-1
votes
1answer
136 views

Syntax error in ArcPy?

I am new to ArcGIS. I am trying to do a lot downscale the data using IDW tool in ArcGIS. I have one shapefile. In this shapefile, I have multiple columns. Each column corresponds to each year. I want ...
-1
votes
1answer
59 views

updateLayer loop with .lyr does not use target field?

I have little experience with python. I'm using ArcGIS 10.4. I'm attempting to create pdfs of layouts in which polygon features are symbolized with the same colors for classes, but the assignments ...
-1
votes
1answer
34 views

How to ensure that a composite locator respects the settings of the component locators?

This question is asked and answered for the benefit of anyone else who may struggle with this specific scenario. Background: Two existing locators, each configured to write a Reference ID for ...
-1
votes
1answer
177 views

Arcpy error when attempting to reference 'CURRENT' mxd with script tool within ModelBuilder

I have an ArcMap 10.5 ModelBuilder model that contains within it a script tool referencing the 'CURRENT' mxd. Both the script tool and the ModelBuilder tool are set to run in the foreground. The ...
-1
votes
1answer
40 views

Passing where clause with range that will prompt user in arcpy.select_analysis?

I am trying to query the user to enter a price range so that all those which are in his range will be retrieved. choice = input("Enter the budget range:") arcpy.Select_analysis("Zillow_Project.shp", "...
-1
votes
1answer
211 views

Randomly rotating polygons in shapefile using ArcPy? [closed]

I have a shapefile with polygons and want to rotate each of them randomly. Centroid of the polygon should be the anchor point of rotation. Rotation example:
-1
votes
1answer
488 views

ExecuteError: ERROR 000229: Cannot open layer Failed to execute (RemoveJoin)

I'm trying to remove a join from table and a layer file and am getting the error in the subject line. Tried using "table" as the arcpy.RemoveJoin_managment() argument and got the the same error. ...
-1
votes
1answer
121 views

Buffering using a field in ArcPy - syntax issue?

I am planning to add a line into my python script to buffer a feature by a field I have calculated Error: SyntaxError: invalid syntax (_01_FULLSCRIPT_ANGLETEST.py, line 320) Failed to execute (...
-1
votes
1answer
43 views

sharing Arcpy codes [closed]

What are the most common websites to share Arcpy codes?
-1
votes
1answer
353 views

ArcGIS pro import modules error

I am currently using python 3.5 interpreter to run pycharm and ArcGIS Pro version 1.1. But my pycharm is unable to recognize the arcpy package settings and throwing me an error showing underline. Can ...
-1
votes
1answer
279 views

Making template (.xml) from Network Dataset using ArcPy with ArcMap?

I'm trying to create a template (.xml) from a network dataset. However apparently the tool is not available but the online ESRI help has code samples. I was wondering if anyone has had the same issue. ...