Quantcast
Channel: Question and Answer » arcpy
Browsing all 767 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Removing last point in polygon geometry using ArcPy?

This polygon was created from a grid of 500 x 500 meters, then Union, Generalize and Dissolve was used to arrive at this geometry, the laspoint not help me, I just want to have points on each vertex....

View Article


Check layer data type in gdb

I have path to layer or feature C:base.gdbtest How to check is table or feature class by arcpy?

View Article


Creating data driven pages via arcpy

We have a data driven pages enabled MXD. Refreshing this mxd in arcmap works and gives me 9000+ pages. Via python however, mxd.dataDrivenPages.pageCount returns 0. Even after...

View Article

What causes AttributeError: 'module' object has no attribute 'da'?

I have a shapefile “selected_polygons.shp” that contains 2000 polygons. I would like to select each polygon contained in the shapefile by using a search cursor in order to apply the function...

View Article

Image may be NSFW.
Clik here to view.

Changing value field when applying symbology from layer using Python Add-in?

I have a python addin button that creates a layer file from a polygon feature class in ArcMap. I want to take that layer file and, with user input from a combobox, apply it back to the feature class...

View Article


ArcPy delete terrain: cannot be deleted

I can’t get my ArcPy script to delete a terrain. If it exists, it should be deleted. However it throws an ERROR 000317: {path} cannot be deleted My script is a lot longer than this, but this is what...

View Article

Merge feature classes in feature datasets

I’m trying to merge a group of like feature classes which are contained within separate feature datasets. I can merge feature classes within a file geodatabase without having issues by creating a list...

View Article

procedurally alter dimensions of embedded Picture_Element

Theoretically, should it be possible using arcpy to alter Picture Element dimensions whose images are embedded? My attempts haven’t worked. I thought to clone these as a possible workaround but those...

View Article


Intersection of two polyline geometries not returning expected coordinates?

T2B = arcpy.Array([arcpy.Point(1,2),arcpy.Point(-1, -2)]) L2R = arcpy.Array([arcpy.Point(0, 2), arcpy.Point(1, -2)]) L2R_line = arcpy.Polyline(L2R) T2B_line = arcpy.Polyline(T2B) cent =...

View Article


Replacing text string on layout text element by reading lookup value from...

I’m not sure what the best way is to go about this, but here’s my situation: In short, I exported a domain to a table (and I exported the table as a CSV, too, just in case it might be easier to work...

View Article

Using search and update cursors for random number generation

I am having some trouble getting a searchcursor to return a value for each record. The purpose of my code is to scan through a list of records in a field (FieldA) and based on those values populate a...

View Article

Python Toolbox (.pyt) Tool Output Layer Name

How can I manipulate the TOC display name of my output parameters when using a Python toolbox (.pyt) Tool class. I tried adding a symbology layer, however this has no affect on the TOC name. Is it...

View Article

Is there a method in ArcObjects that is equivalent to ArcPy's:...

I have 2 IFeatureClass and I want to do an INTERSECT between the two. What is the best way to do this from ArcObjects?

View Article


Naming directories in python?

Why is it that when I label my directories this way: arcpy.env.overwriteOutput = True arcpy.env.workspace = "C:\Users\Documents\ArcGIS\Testing" arcpy.env.scratchWorkspace =...

View Article

How to batch process near feature distance in ArcGIS

I have 2000+ point shape files. These are all GPS tracks. I want to calculate the distance from each point to the nearest feature (road, train line, restaurant etc) within a 30 meter radius. I am using...

View Article


python code to create an intersection loop with a geodatabase

I am trying create a loop that will intersect each individual township with a statewide section layer. I am having trouble with the syntax of the intersect tool I think, but maybe it is something else....

View Article

Image may be NSFW.
Clik here to view.

arcpy.Describe.extent not working

I have a script using ArcPy that I used a year ago and calculates the extent of all the features in a shapefile: # -*- coding: utf-8 -*- import arcpy from arcpy.sa import * import os, os.path...

View Article


How to get around "name 'row' is not defined" error when row in question...

I am getting a “name ‘row’ is not defined” error when I run a particular piece of code (see below). This only happens when my input layer has one entry instead of two. So when the attribute query is...

View Article

Algorithm to implement for batch processing in ArcMAP modelbuilder

This question already has an answer here: Using Collect Values Tool with Union in ModelBuilder? 1 answer

View Article

How to check whether an optional FeatureSet parameter was set by the user in...

I have created a custom geoprocessing script tool which contains an optional FeatureSet parameter. When unpacking the parameters in the script, the FeatureSet is defined as a RecordSet object, even...

View Article
Browsing all 767 articles
Browse latest View live