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

AttributeError: 'Layer' object has no attribute 'listLayers'

I want to use the result of OD cost matrix for my further calculations. However, whne I try to extract the sublayer “lines” it returnes an error AttributeError: ‘Layer’ object has no attribute...

View Article


arcpy UpdateCursor throws exception on geoprocessing service?

I wrote Python code that changes the state of a feature by ID. I am not using a Python Toolbox (.pyt). I wrote a python script and added it into a standard toolbox (.tbx). Using ArcGIS Desktop...

View Article


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....

View Article

Image may be NSFW.
Clik here to view.

Calculating several cells into one cell in same table using ArcPy

I’m very new to Python and scripting in ArcGIS. I need to calculate some cells from one field in table into another one cell in another field in same table. Here’s what i need: Here’s what i try and it...

View Article

How to transfer SQL variable back into ArcPy script?

I am trying to teach myself to access sql tables from an ArcPy script as part of a larger QC process. I am fairly certain that I have the sql statement correct (it works in SQL Server, albeit formatted...

View Article


Using PyScripter with ArcPy: “import error, no module named _base”

I’m trying to use ArcPy in PyScripter. I don’t have admin privileges on this computer (it’s my work computer) so I have to use a portable version of PyScripter. I’m sure my boss would let me install...

View Article

Image may be NSFW.
Clik here to view.

Extracting channel banks from DEM and channel newtork

Currently I am working in project that require from me extracting channel banks. I have been thinking about the best method that I can use to come up with good function that extract the location of...

View Article

Python importing Arcinfo to Python 2.7.11 Script

I am having trouble getting an arcinfo license using a python script. When I try to call “import arcinfo”, making sure it is my first line of code because of legacy issues, I get the following error...

View Article


Why does the Legend vanish when exporting MXD to PDF using ArcPy?

I try to export multi MXD files into pdf. The code run without an errors, but the problem is that the legend vanished from several pdf files: import arcpy,os import arcpy.mapping from arcpy import env...

View Article


Update cursor for joined field

I have a huge point vector data (around 3 million point; in a gdb) with attributes and I have table (created with Near analysis.). I want to copy one of the field values to data. So I joined the table...

View Article

Update a group layer using arcpy

I work with several MXD’S and i try to update a group layer named “allHa” containing several layers with this code: import arcpy,os,sys,string import arcpy.mapping from arcpy import env env.workspace =...

View Article

Apply Symbology to shapefile – change the field value but not the symbology...

I have a shapefile that has multiple fields. I have a applied a manually applied graduated colors, and ranges. What I need to be able to do is copy the shapefile in the toc and change the Symbology –...

View Article

Referencing Dataframe with ArcPy in Geoprocessing Service?

I have a geoprocessing service that was successfully published to our Server instance. I’m using 10.3 which means we could not publish unless it was successfully run as a tool in ArcMap. But now when I...

View Article


FeatureClassToFeatureClass_conversion: How to export feature class to...

I am trying to automate a workflow which involves exporting multiple feature classes (within a geodatabase) to shapefile format. My inclination has been to use the...

View Article

Image may be NSFW.
Clik here to view.

Python script outputs polygon feature class with no shape_area or...

I am trying to copy features a number of times based on a numeric field value. The code below works for points when the POINT type is chosen. However, when I switched the feature type to POLYGON it...

View Article


creating unique sets randomly distributed values for many defined areas…in a...

I have a large approximately circular study area comprised of 5000+ polygons which represent forest parcels. For each of these polygons I have up to 4 different species. These species occur in an...

View Article

Reading feature class attributes with or without quotes in ArcPy?

I’m working on a script that clips a batch of feature classes by a selection made in another feature class. The way it works is by reading the clip feature fields, then allowing the user to select the...

View Article


Define Projections for layers with multiple locations in MXD's

# Script to use Layers in MXD source file paths to locate and redefine projections import arcpy, glob, os, sys, arcgisscripting mxd = arcpy.mapping.MapDocument("N:MXDs_ThomaKLMXD GPS...

View Article

How to to get current legend column count using arcpy?

I can change the numbers of columns in the legend using arcpy.adjustColumnCount(column_count). However, in my particular case I would like to know how many colums there are in the legend in the...

View Article

Image may be NSFW.
Clik here to view.

Extend line to specific distance or a line

I want to extend my polyline to a given distance. How can I do this. I have attached image to clear my specification. I am using .net in ArcMap . I am also using python in the image, I want to extend...

View Article
Browsing all 767 articles
Browse latest View live