A site-package created by Esri to expose GeoProcessing from ArcGIS to Python.

learn more… | top users | synonyms (7)

4
votes
2answers
92 views

ArcPy: Save and open mxd without closing ArcGIS

With Python Add-In Wizard I created a Button which: looks in a specific directory for the last created/modified folder (which is created with another tool) saves the current mxd with a new name in ...
1
vote
2answers
32 views

Trying to maintain spatial reference on newly created numpy array

I am trying to copy the values from raster into newly created array and then trying to save the array with same spatial reference as raster file inRas = arcpy.GetParameterAsText(0) double_layer = ...
1
vote
0answers
31 views

Translate ArcPy to QGIS for focal sum statistics [closed]

Sometime ago, I asked a question (Arcpy to append results of pivot table) with the result being python 2.7 script that works in ArcGIS 10.3. It is fairly simple - it iterates over all the points in a ...
1
vote
2answers
66 views

Redefining point shapefiles in MXD that have no projection and are located in different folders using ArcPy?

# Script to use Layers in MXD source file paths to locate and redefine projections import arcpy, glob, os, sys, arcgisscripting from arcpy import env, mapping path = os.getcwd() env.workspace = ...
2
votes
2answers
108 views

Trace Geometric Network won't execute in custom script tool

I'm trying to make a Python script tool which uses the Trace Geometric Network tool (10.3). My script works in the Python window, but as a script-tool, it runs and NOTHING HAPPENS. Messages state: ...
7
votes
3answers
425 views

Pythonic alternative to Feature to Point (no advanced license)

I have a set of polygons I have calculated the centroids of, but am having trouble finding a way to output these values to a point shapefile. I dabbled with arcpy.MakeXYEvents_management, but it only ...
1
vote
1answer
43 views

Error when writing polygon feature

I have created this array: array = ([arcpy.Point(-103.85769159, 32.181106371), arcpy.Point(-103.85769159, 32.182755629), arcpy.Point(-103.85575241, 32.182755629), arcpy.Point(-103.85575241, ...
0
votes
2answers
77 views

Using Python Search Cursor results to Select Features by Attributes

I would like to preface this by saying that I am very new to python and its capabilities. So my problem is that while using the in_memory work space I encountered some limitations in querying the ...
2
votes
3answers
47 views

Stacking multiple selected points in ArcGIS

I would like to find a way to stack multiple selected points in ArcGIS, either using the field calculator or python script. For example, I want to snap all points representing houses on a street into ...
0
votes
0answers
26 views

return _NumPyArrayToRaster(*args, **kwargs) ValueError

I am trying to make an array to raster from the defined array below. However, I keep getting this error: return _NumPyArrayToRaster(*args, **kwargs)ValueError: Argument in_array: A two or three ...
1
vote
1answer
39 views

extracting time information from arcpy.da.searchcursor and Tuples

So I have a feature class in a GDB that contains time data that I wish to carry out calculations through arcpy. This data was entered from a string to a datetime format into the featureclass through a ...
0
votes
3answers
84 views

Get the first and second row with searchcursor

I have a shapefile with only 4 rows in it. I already could filter it so I have only 2 left. I need these sorted by the 'length' field, then take the first and second row to save in to individual ...
1
vote
1answer
26 views

Converting tuple into records in blank feature class using ArcPy?

Here is the code block that I am using with ArcGIS 10.2 for Desktop, it all works great except for the bottom part. I am not sure how to turn the tuple into records on a blank feature class. The tuple ...
2
votes
2answers
37 views

Delete records in feature class that have same ID in CSV table using arcpy cursors

So I have a csv table with records that have an ID. I want to find the same IDs in a feature class/shapefile and delete those records in the feature class/shapefile using Python. I've messed with ...
0
votes
1answer
28 views

Is there a way to turn a data frame off in ArcMap 10.2?

I have an mxd with three data frames. I've written a python script that loops through a list of user-specified coordinates and scales for each data frame before exporting the mxd as a pdf. Is there a ...
0
votes
0answers
26 views

Trying to print classLables in symbology type UNIQUE VALUES

I have a classified image of 10 classes stacked together. Once I put them into ArcMap they don't appear as 10 individual classes, they look like one big class. When I click on unique values the ...
1
vote
0answers
42 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
47 views

Return FeatureLayer in geoprocessing REST service

I have created a Python Script Tool that returns a FeatureLayer using the following two lines of code: arcpy.MakeFeatureLayer_management(scratch_fc, "GeocodedZIPsLayer") arcpy.SetParameterAsText(1, ...
8
votes
1answer
153 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 ...
1
vote
2answers
84 views

Error while Geoprocessing with Geometry Objects

I'm trying to use the distanceTo() mehtod to return the distance between the centroid of a polygon and a line, but I keep getting this error: "AttributeError: 'Point' object has no attribute ...
0
votes
0answers
34 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 ...
3
votes
4answers
207 views

Get Parameter as Text and select layer by attribute

I have written a python script tool wherein a user specifies a feature class (e.g., Landuse) containing different attributes (e.g., parcel size, landcover etc.), name of the attribute field from which ...
-1
votes
1answer
35 views

raster calculator (spatial analyst) tool not working in arcpy [duplicate]

I am using arcpy and while running the script it is unable to find RasterCalculator() method? Even after imporiting arpy module >>> RasterCalculator("IDSI_2002.img + ...
3
votes
1answer
56 views

Choosing and zooming to features using SQL query in ArcPy with ArcGIS Pro?

When using ArcPy with the ArcGIS 10.x architecture there is a simple coding pattern that I find I use frequently: import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") df = ...
1
vote
0answers
50 views

How to select specific rows in attributes table by using ArcPy? [closed]

With the zonal statistics as table I made a "park_dem.dbf" file which shows in 28 rows the name of polygon and also several information about the (max-min-range-area) so my question is, have can I ...
1
vote
1answer
47 views

Select points situated on zero degree slope

I need to choose points from SHP file, which are positioned on raster cells with 0 degree slope. Creating a slope raster from DME is not a problem, but I don’t know how to write a script that chooses ...
3
votes
2answers
50 views

Select point(s) from given coordinate and move to new coordinate using arcpy

Goal: Move address points to their correct location. Plan: I have a layer of AddressPoints of which some need moved to a new location. I want to take a line layer (called ...
0
votes
0answers
22 views

Selection Based on Range of Values from another table

I'll try to explain this is as simply as possible. I've figured out how to create this table in SQL, no problem. But I'd like to have this done in python as part of a larger model. I have a feature ...
0
votes
1answer
48 views

python code multirasters zonal statistics

env.workspace = "C:\Users\\Documents\pythonMODIS\extract" # Set local variables inZoneData = "mask.shp" zoneField = "Classes" inValueRaster = "mi1511171_clip.tif" outTable = "zonalstattblout02.dbf" ...
1
vote
1answer
29 views

Inputs for building composite address locator from address locators created in for loop of Python script tool?

I'm building a script tool that creates up to 3 address locators and then uses the output address locators as inputs to the final output composite address locator. The tool executed perfectly prior to ...
0
votes
0answers
19 views

Is it possible to create TIN layer and add to Data frame?

I have list of TIN. I basically want to add TIN using arcpy.mapping so that when I open .mxd, TIN is added. tin_list = arcpy.ListDatasets('', 'Tin') for tin in tin_list: ...
0
votes
1answer
33 views

How to append Extent object to existing dictionary key values?

I have a dictionary whose keys are map segment names, and whose value is a list of 3 field values. Using an arcpy.da.SearchCursor on the map segments FeatureLayer, I have extracted the extent object ...
2
votes
2answers
60 views

Problems with SQL expression formatting and calculate field management

I am trying to take the population census tract and calculate the percentage of population by each census tract in the field (Populati_2). To do this I'm creating a new field with the total sum of the ...
0
votes
0answers
23 views

Creating an .mxd Thumbnail JPEG

After creating a Map Document Object and calling the .makeThumbnail() method, how do i create and save a JPEG of the Thumbnail image i just created?
0
votes
2answers
29 views

Python select by attributes, location, copy features [closed]

Python script is failing. It's supposed to make a selection from a lyer based on attributes value and then select intersecting features of that selection and then make a copy of the selection as a new ...
0
votes
1answer
38 views

Output Feature Class empty after trying to display it on map using arcpy.mapping?

I am trying display the output of my script on an mxd once it is created. To do this, i created a function at the end of my class that handles all mapping. I have tested the code up until the ...
3
votes
2answers
74 views

Trying to optimize, arcpy.da.Walk seems slow - but not sure if that is the primary issue

So the deal is, I'm trying to automate a workflow that currently costs a co-worker about 45 minutes. General run down is this person copies files from a network drive onto a local one, and process it ...
2
votes
0answers
34 views

Arcpy.sa NoData issue with saving TIFF

Similar to the poster here, I am attempting to convert numerical NoData values to actual NoData cells. The solution in the linked question doesn't work for me, however, as when I use the save method ...
0
votes
1answer
46 views

Automating ArcGIS append Geoprocessing Tool [closed]

I have about 100 feature classes inside twenty feature datasets inside a geodatabase. We have about 50 individual geodatabases. I want to load all geodatabases one by one in a one single master ...
0
votes
1answer
49 views

script for auto registration

I have a large list of raster images (>600) I would like to automatically georeference to a source image. I can do this in ArcGIS 10.2 using the Auto Registration tool for each image but looking for ...
3
votes
1answer
47 views

Changing Dataframe Projection of .MXD to UTM Zone matching each polygon in ArcPy cursor?

I have a polygon shapefile. I used ArcPy scripts to: add a new field to the shapefile use Calculate UTM Zones on each polygon. It spits out UTM projection information into the field I've added. ...
1
vote
1answer
57 views

Deleting selected features with ArcPy?

I am having trouble deleting the features I have selected using 'arcpy.SelectLayerByLocation_management' tool. To use the select layer by location tool, you much pass in a .lyr file. My script ...
2
votes
1answer
56 views

Complex polyline traversing with searchcursor

I have a very specific question about searchcursor traversing complex polyline. My setup is: I imported public transport routes as a single polyline with length in meters. Along this polyline I want ...
1
vote
0answers
18 views

How to populate a record based on the sum of selected features on a different layer, python? [closed]

So basically here is my outlined workflow. I have a point layer and a line layer. My points have a cost value associated, and my lines represent highways. All points fall on lines, therefore I would ...
0
votes
0answers
31 views

ArcPy FeatureCompare vs. FileCmp

I have a huge number of shape files that I receive on a recurring basis. I want to be able to compare the new version to the current version, and then only update the db with those that are different. ...
0
votes
1answer
20 views

Cell Statistics failing to read rasters in list

Heyo. I'm trying to get the rasters from a list (about 32 rasters) and then sum them up with CellStatistics in arcpy. I'm using Python 2.7.8 and ArcGIS 10.3.1 I got it to work the first time around ...
0
votes
2answers
80 views

Migrating ArcGIS for Desktop script to ArcGIS Pro? [closed]

Recently I've been considering switching my department over to ArcGIS Pro in an effort to stay ahead in the ever-advancing world of GIS software. Currently we run ArcGIS 10.3, and have many daily ...
0
votes
2answers
33 views

update cursor based on location

I'm working on a python script for ArcGIS 10.2/10.3. What I want is to automatically fill in a field of a point layer based on the location of that point in relation to a polygon layer. Say I have a ...
1
vote
0answers
34 views

Using arcpy.Geometry() and attribute table?

I have Polygon layer (*.shp) and I need to calculate shortest distance between every polygon's and save it into a txt file with ID (it is in attribute table) for every polygon. example of txt file - ...
1
vote
1answer
96 views

Using arcpy.GetParametersAsText() into Text file? [closed]

I've just started using Python for ArcMap. I'm trying out a script that works before I put arcpy.GetParameterAsText(0) into it. Does anybody know what I'm doing wrong? (I put the parameters on the ...