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

add-in works at once only

There is a sample in ArcGIS 10.1 help on creating a add-in using python. This works only once when a layer is selected in combobox, if i need to use this functionality again it does not work and i need...

View Article


arcpy, CalculateField: 'geoprocessing sys.stdout object' object has no...

Working with 10.2.2, 64bit geoprocessing arcpy installation. Getting this error from arcpy.CalculateField_management() command. From Spyder IDE in an ipython console, I get the error: [IPKernelApp]...

View Article


Updating field in feature class using ArcPy cursor?

I want to update a field in my feature class. I tried to use a da.SearchCursor (code below) but was quickly reminded that tuples are immutable… I ran the code but it failed with a TypeError: 'tuple'...

View Article

Failed to execute (ExtractByMask)

I use ExtractByMask of arcpy to isolate to subset the provinces of the Philippines. I do it with this code. import arcpy from arcpy import env from arcpy.sa import * arcpy.CheckOutExtension("Spatial")...

View Article

Running Python script in Task Scheduler— Script will not run

I have a script which I wish to run on a regular monthly basis without me needing to open and run the it. I have referred to every web page I can find on Windows Task Scheduler and followed their...

View Article


Python encoding error in ArcPy

I am writing a JSON file, as string input, using python, into a .json file in the file system. However I am getting the following error sometimes and I don’t know why. Any ideas? UnicodeEncodeError:...

View Article

Calling a GP service from a GP service arcpy.Importtoolbox

I’ll try my best not to sound like a lunatic as I explain this. I have a python script that calls an ArcServer geoprocessing service toolbox with arcpy.Importtoolbox. The GP service is on several...

View Article

Running Python toolbox tool both standalone from other tools within same...

I have created a python toolbox for work that has two tools inside. These tools use the toolbox template and so have a init, getParameterInfo, etc. I want to be able to run one tool both stand alone...

View Article


Check field type and execute depending on it using ArcPy?

I had a script that converted data from a clients site to a usable GIS format until they changed the output. I’ve tried two different directions with no luck. Due to how an earlier part of the script...

View Article


Image may be NSFW.
Clik here to view.

Sum fields from ListFields – RuntimeError: A column was specified that does...

Does anyone have a suggestion on how to otherwise solve the problem … The need to automatically generate all the columns from the table, the calculation of the sum, the results are updated in the new...

View Article

How do I enumerate the messages in arcpy.GetMessages()?

Messages are present in GetMessages() but it’s a formatted string. I want to add some of my own newlines and alter the content on a per-message basis. How do I access the individual messages in...

View Article

Arcpy: Using where clause in append_management

I would like to write a script where I select a feature class by attributes, add a field for a timestamp, and append the selected features to another feature class. My code is below; Do I need to...

View Article

Reclassification of raster

Is there a better way to do this? I’m trying to create a script that will change classifications of a raster to: 0 for: 0,7-9,15-20,40,62-63,73,78-87,89-130,132-151,153-175,177-203,215,228,251-253 1...

View Article


Create KML from MXD that contains map service layers like feature layers

How can I create a KML (tools suggestion), provided that I have a map (.mxd) file which layers are service layers of hosted services and not local data coming from a geodatabase. I know that the map to...

View Article

Retrieve locally the data of an mxd that are contained in sevice layers and...

I want to get/dowload the data contained in a map service and recreate a new mxd file with static (not retrieved from a service) data. I am interested for data coming from feature and graphic layers....

View Article


Export DDP to MXD based on Raw_Input?

I am running ArcGIS 10.2.2 Version 10.2.2.3552, using ArcMap. I have searched and haven’t found anything on this or if it is even possible. I’m trying to add something to my script that allows the user...

View Article

setting data frame extent set to a shapefile

I need to set the data frame extent set to a specific shapefile in my Table of Contents. I am not sure how to go about this. Some of the codes I have found deal only with zooming into a selected feature.

View Article


Creating Tkinter dialog box in arcpy?

I would like to create a dialog box which pops up when the user click on a button from a Python Add-In toolbar. The user will navigate to their preferred file and select any shapefiles they wish to add...

View Article

Image may be NSFW.
Clik here to view.

Time.Sleep between arcpy.mapping.ExportToTIFF in Data Driven Pages

I’m building a code in Python to export in geotiff my imagery. I need specific spots so I created a Data Driven Pages with polygons. Everything works fine, except that my imagery layer takes a long...

View Article

arcpy fails to retrieve queried data from a layer using arcpy.da.SearchCursor

I am attempting to retrieve rows of data from an attribute table using arcpy. I have used a definition query on the data in ArcMap so that only one feature is present in the attribute table. I then...

View Article
Browsing all 767 articles
Browse latest View live