Tagged Questions
0
votes
0answers
28 views
OD cost matrix Arcpy
I'm trying to create an OD cost matrix python script.
I'm doing an OD cost matrix analysis. I'll find out the average time with patients to hospitals over 10 years. When I do this analysis, the ...
0
votes
0answers
67 views
python script to calculate and return values based on several conditions
I need to calculate and return the value "continuous" to those records in a polygon feature class with species records aggregated to a UTM grid
considering the attributes are species name, grid code, ...
1
vote
1answer
79 views
How to use CURRENT map document in Python tool?
I am attempting to use this code in a tool that I am working on:
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
XMIN = df.extent.XMin
YMIN = df.extent.YMin
XMAX ...
0
votes
1answer
42 views
How to insert values from one table into another?
I am trying to write a script that iterates through each row of a table, calculates for this row something. The result of this calculation is finally stored in another table (with just one row). Now I ...
2
votes
1answer
44 views
Tabulate Area crashes Python and ArcGIS
I have a script that runs Tabulate Area on a single feature class multiple times with different rasters. In total Tabulate Area runs 5 times. 2 of the input rasters are provided as arguments to the ...
1
vote
2answers
52 views
ArcGIS 10.1: “ERROR 000223: Cannot extract event table properties” when iterating through multiple files/folder
I am trying to convert ~270k csv-files with lat/long-data to layerfiles. The files are split into folders by year, i.e. ~30 folders with ~9k csv-files in each.
I have written a script to iterate ...
5
votes
2answers
89 views
How to do advanced Python labeling in Arcmap?
Does anyone have a good reference for advanced/complicated labeling expressions in Arcmap? I am attempting to write a Python label expression that would involve multiple label definitions.
Here is ...
1
vote
1answer
82 views
Search cursor stops selecting after two iterations
I have a script which selects an extent from a grid and exports the data frame.
import os, arcpy
mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
...
4
votes
1answer
45 views
Using matplotlib to create and export graphs automatically from ArcMap
I am going to start a project soon where, after the data has been processed in various ways, an output jpg showing a graph of the data should be produced. The workflow is as follows:
1. A feature ...
3
votes
1answer
57 views
Why is my simple arcpy script failing? (sets raster cell value to null if below threshold value, ArcGIS 10.1)
As mentioned in the title, simple script to set null cell values below three standard deviations beyond the mean:
import arcpy, sys, os
#Accept input and output raster
inRas = sys.argv[1]
outRas = ...
2
votes
2answers
87 views
Help with Python and adding a grouplayer to arc, renaming it from a folder name, then adding layers to it from that folder
I am trying to use os.walk to go through a directory tree, pull out all the .shp files in it, create a grouplayer in the mxd, rename the grouplayer the folder name, then add the layers from that ...
1
vote
1answer
54 views
How to get an attribute of the selected feature and pass it into a URL?
As a total Novice with Python, I thought 2 weeks would be enough time to learn how to build some tools for our GIS... I was wrong and I'm running up on a deadline.
I am attempting to get a value ...
1
vote
1answer
65 views
GDAL bindings problem with ArcMap 10.1 Python tool
I'm really getting mad with this. ArcGIS sometimes can be so just...irritating!
Forgive me if this question is by any means duplicating this one or similar ones, but I really can't find my way out of ...
4
votes
1answer
60 views
Populating a Value List in one Parameter, from Values Derived from a Second Parameter, Python
Using the Validator in the ArcGIS 10.1 tool GUI, can I loop through and List feature classes from a workspace type parameter (ie a file geodatabase) and then go on and list the values of a field in a ...
1
vote
2answers
76 views
access attributes of one class for use in another class in python add-in
I want to get combobox attribute 'dem' and use it for further processing in class ExtentData. But I am not sure how to get attributes from one class to another for processing in pythonaddin. In ...
1
vote
1answer
67 views
Calculate Field using Esri Python Addin
I am trying to select a polygon then it must automatically change (calculate) the status to "C". The tool seems to work in the background but nothing actually happens (the status is not updated). I ...
7
votes
2answers
93 views
Autoincrement field when New Feature added
I know that this is probably a very basic programming but I am brand new to Python.
I have a layer in a geodatabase that I need a unique ID field (for joining). I can't use the ObjectID because that ...
1
vote
1answer
33 views
How to keep specified separation distance between features in printout from ArcMap?
Does anyone have a solution to select features using attribute values and print only the selection keeping a specified separation distance between the features in the printout in ArcMap.
2
votes
2answers
87 views
Create point geometry in a feature class with all the attributes prepopulated
So here is the problem. I have a text file with space delimited values. A standard text file with the headings separated by spaces and then on each next line values for these headings (columns) also ...
2
votes
1answer
108 views
Error 999998 in Arcpy 10.1
I found an RuntimeError: ERROR 999998: Unexpected Error when lunching Arcpy in my ArcGis 10.1 such as this:
Runtime error
Traceback (most recent call last):
File "", line 50, in
File ...
3
votes
0answers
61 views
AGS 10.1 geoprocessing service returning the wrong URL
I have an image export geoprocessing service that runs on ArcGIS server 10.1. It works by writing an image out to the scratch folder, and returning the location of that image.
Basically just this:
...
0
votes
2answers
73 views
How to interact layers with a nested loop?
I've dealing with the code below with such a long time. I have to show in a raster image the result of calculating the cost of the electricity for a solar plant. The thing is that I have to interact a ...
1
vote
0answers
43 views
Using Python to Switch Layout Templates
Using ArcMap 10.1: Since there is not a way to control portrait or landscape of the layout view through python, is there a way to switch layout templates without opening a new mxd through python? ...
3
votes
3answers
131 views
Field calculator error [duplicate]
NOTE: This problem is similar to one that was answered here: Why does Field Calculator return 0 values when decimals are expected?
I'm relatively new to python, and am trying to run a simple field ...
2
votes
1answer
49 views
Script to either rotate existing text element or insert graphic element
I have about 300 maps that contain a text element that needs to be rotated. I am pretty new to python but I have heard how great it is. This seemed like the perfect task for python but I have had no ...
2
votes
1answer
63 views
Calculate field result is float with Arc tool, integer with arcpy script
I am trying to calculate a field for some points within a python script using arcpy functions. (This is calculating the percentage visibility from a cumulative viewshed, if that matters.)
# Process: ...
3
votes
0answers
110 views
Python Script Crashing Inconsistently on Arcpy Batch LayerToKML script
I put together a script to take a TIGER shapefile of all census tracts in a state, select the census tracts by each county, and export them into individual county-level kml files.
The problem is that ...
0
votes
2answers
68 views
Python Addin Toolbar only works once
I am writing Python Addins for ArcGIS. I call a Python Toolbox, the Addin tool only works once in ArcCatalog when picked. If you pick it again nothing happens.
import arcpy
import pythonaddins
import ...
4
votes
2answers
105 views
Python Script to convert a mass of KMLs to a single fGDB
I have a mass of KML files, approx 350+ that I need in a single fGDB. I lifted a string of code from ESRI help to attempt to do this - I got it working to the point of creating all the individual ...
1
vote
1answer
88 views
Cast arcpy result as an integer instead (arcpy.GetCount_management)
I am trying to get a number by counting how many points are in a shapefile. And this works (I think), except I then am running into trouble using that number somewhere else. Eventually, I'll be using ...
3
votes
0answers
110 views
Python coding question, looping through feature classes, AddField, CalculateField, then errors (might be schema lock)
This is not a SDE question. File GDB.
Hi, I have a general question on looping through feature classes in a file geodatabase. I have (attached) a python script that adds a ton of fields and ...
8
votes
1answer
220 views
Fastest methods for modifying attribute tables with Python?
A while ago, I wrote a quick Python function for converting an attribute table to a python dictionary, where the key is taken from a user-specified unique ID field (typically the OID field). ...
1
vote
1answer
56 views
Importing arcgis.rand error from python shell
Not sure what's going on here with this module. Maybe a pathing issue?
If I import the module from the python window in ArcMap it works.
If I import it in a script, and use that script in a ...
0
votes
1answer
61 views
Accumulate value loop [closed]
I am new to Phyton and currently trying to get my first script to work. Could someone tell me what is wrong with this code:
total = 0
def accumulate(increment):
global total
if total:
if (total ...
2
votes
1answer
85 views
Mysterious Invalid Syntax in Field Calculation
I'm trying to calculate a field in Model Builder using the Calculate Field tool. I'm using the following code block and expression in the calculation, but am getting an "invalid syntax (, line 1)" ...
3
votes
2answers
126 views
ArcGIS script tool: Can you have an input parameter set to optional and have the tool work when an input is not provided?
I'm building a script tool that processes shapefiles ( GPS data collected on weekly basis). The tool is set up to take an input for each shapefile ( in this case Sewer, Storm, Sign). On some days, ...
2
votes
2answers
42 views
How do I create a network from connected links
I have a bundle of links in 'some' networks. I need to find out which ones are connected to each other i.e. I need to find out which links are not connected to the 'main' network.
I have been working ...
1
vote
1answer
82 views
Using field mappings to remove fields from a merged table
EDIT: Soreted, thanks :-)
I'm trying to combine a (large) number of tables into a merged table, keeping only certain fields. I've tried the below, but it still gives all the fields. Any ideas?
...
0
votes
1answer
107 views
How to refresh a Combobox Add-in in ArcGIS 10.1
I need to refresh the value in the combobox after an event from other tool in the same add-in (ARCGIS 10.1. Python).
I've changed the value of the combobox with the code: combobox.value = val
and I ...
0
votes
0answers
36 views
SQL statement in MakeTableView_management
EDIT: Finally found a way around this..
expression = "[Route] = '" + route + "' AND [Trip] = " + str(trip)
arcpy.MakeTableView_management(solutionTable, "solutionView", expression )
I tried str() ...
3
votes
1answer
139 views
Arcpy does not execute “CopyFeatures_Management” to write a featureclass to an ArcSDE database
I have some problems with my Python script. The script gets an JSON with different information about images. The information includes general information about images and also the gps position of ...
1
vote
2answers
101 views
Select Layer by Location - Arcpy - Why are my inputs being interpreted as invalid?
I am working on a tool in a python toolbox and am totally confused about what is going on and causing my select by location operation to fail (Error 000368).
I am trying to select the features in one ...
4
votes
1answer
94 views
Slow performance on splitting a shapefile by attributes
I've tried to develop some workflows with the ArcPy module for splitting a shapefile based on the unique values in a specified field. The code works as expected except one thing I am not able to ...
5
votes
1answer
73 views
Cursor only completes one loop
I am at the end of my rope here. This cursor runs fine for one iteration and then stops. It doesn't throw an error, it just completes. There are 3,000 rows in my table, so I don't know why it would do ...
6
votes
2answers
187 views
ArcGIS 10.1 Python Addins - Am I doing this right?
I have been developing a few python addins and I'm just wondering what is the best way to re-compile the addin anytime I edit the script.
Currently, if I make an edit to the script, it seems like I ...
1
vote
2answers
123 views
Batch set value/calculate field inside Cursor
I am matching data using a cursor, where one of the final steps is filling in a new attribute, match, with a value calculated during the cursor. This matching is done to an ID field in the original ...
2
votes
1answer
124 views
Refresh combo box in add-in
I've got an add-in with a combo box and want to refresh the list in the combo box after an event in one of the other tools in the same add-in toolbar.
Can I call the combo box somehow to refresh it ...
2
votes
2answers
214 views
“The tool not licensed” ERROR on a geoprocessing service on ArcGIS Server 10.1
I have a python script which runs well as geoprocesing tool. When published on ArcGIS Server 10.1 as geoprocessing service, however, it throws the following error:
Unable to complete operation.
Error ...
2
votes
1answer
155 views
Multiple ring buffer on point-shape error
I need to calculate multiple ring-buffers, but every time I try, arcgis produces a failure:
Executing (Multiple Ring Buffer): MultipleRingBuffer Y:\GIS\RDY\clip\sn_clip.shp ...
0
votes
1answer
93 views
Clip data and add layer to second dataframe using python Add-In
I want to clip a layer from data frame 1 and add it to the data frame 2 using the following script. But instead it just add all grids to current data frame 1 and don't update data frame 2. Please ...



