A site-package created by Esri to expose ArcObjects to Python.
1
vote
1answer
21 views
ArcPy space in textfield
I got a tiny script:
def calc(value):
if value is '123':
return 'ok'
elif value is '12 3':
return 'not_ok'
else:
return value
if the value is without spaces it works perfectly, but ...
1
vote
0answers
13 views
Insert last coordinates from a list of coordinates with line ID into a multipart polyline feature class
I'm having problems creating the last line from a list of coordinates that I have. I have a text file with coordinate data with a X, Y, and a Line ID (LID). I read the file and inserted each ...
1
vote
1answer
24 views
Batch Aggregate Raster using Python
Trying to write a python script to batch Aggregate a bunch of different rasters. get a Parsing Error Syntax error for line 11.
# Batch Aggregate raster tool
import arcpy
from arcpy import env
from ...
0
votes
1answer
20 views
Why does AddField give ERROR: 000732 Input Table: does not exist or is not supported?
I was handed off a a bunch of state shape files and wrote a script to add a few new fields and calculate some attributes. The first line in my script is -
...
1
vote
1answer
21 views
How to move / offset point locations using ModelBuilder or ArcPy
I have a number non-georeferenced CAD layers (see this question) that have text annotation features. I have created a model to convert the text to points, but after converting the annotation to a ...
3
votes
0answers
28 views
extend line to feature. programatically
Thanks in advance for any help. I'm trying to programmatically extend hundreds of lines to a single polyline feature. Sometimes the lines intersect each other, but I'd like the lines to extend, not to ...
2
votes
1answer
16 views
Using update cursor on a field with a domain
I have been replacing field calculations with python update cursors in many of my work flows and today I ran into a problem. The fields being updated have an attribute domain. so now, when I ...
2
votes
2answers
48 views
Determine ArcCatalog's currrently selected folder using Python
Is there a way to get the current directory opened in ArcCatalog 10.0 using Python?
Something like os.getcwd() but instead gives the selected folder on the catalog tree.
Cheers
-1
votes
0answers
37 views
Why does script exported from ModelBuilder give error at Clip?
Can anyone help me with ModelBuilder/scripting?
When creating a model I've used buffer, clip, select by location, create layer, create table...
... but, when i export the model as a script and run ...
0
votes
1answer
26 views
Why does script exported from ModelBuilder give ERROR 000733 at SelectByLocation?
I created a model in ModeBbuilder, and I exported the model as a script, but when I try to run it I get the following error. I have added my error below and the code below that. Thanks for any help.
...
1
vote
1answer
37 views
How do I change the isNullable property for a field?
Once in awhile I encounter a field in my featureclasses that have their isNullable property set to No. Is there a simple way using python to correct this? I came up with this code, but ...
1
vote
1answer
41 views
arcpy selectByLocation
EDIT: OK, added two lines to the code below including a projectAs().
When I start my mxd and run this code it selects a polygon. However, if I then pan to a new location - still within the bounds of ...
0
votes
3answers
71 views
CalculateField doesn't work when called after setting the output extent
I'm quite new to ArcGIS, and now I have to work on a script that goes through a list of feature classes to:
add a field to their attribute table and
fill that field with a number that I retrieve ...
0
votes
2answers
27 views
“ERROR 000840 | The value is not a Relationship Class”
I'm stumped here. I've seen this error in other posts but not quite in the same context. I'm trying to run the arcpy.management.CreateRelationshipClass() tool in ArcGIS 10.0. Absolutely everything ...
2
votes
1answer
39 views
Looking for ArcPy tool for calculating statistics on field with summary field AND boolean fields
What I'm searching for is a tool that will sum a field by a secondary unique field AND booleans...
Let's say I have 12 table each with 4mil records and the following fields:
Donation_Amount ($ ...
0
votes
1answer
42 views
Opening/closing an MXD that uses “production mapping” for dynamic tables in Python
I am currently working on a project that requires using a python/arcpy tool to allow a user to create a map series report PDF. Without getting into much detail, the tool is used when in ArcCatalog or ...
0
votes
2answers
59 views
Error 000368 selectbylocation in script from model builder
Can anyone help?
I created a model-has buffer,clip, selectbylocation....
I exported the model as a script but when i try to run it i get this error:
Executing: IGISprogrammingscript ...
2
votes
1answer
29 views
Renaming shapefiles with prefix while running arcpy.FeatureClassToGeodatabase
I'm fairly new to the arcpy world. I am trying to create a script in 10.0 that will load a dataset (file geodatabase) into ArcSDE and rename the feature classes with a prefix, i.e. San_Diego_Bay -> ...
1
vote
1answer
32 views
Scaling DA UpdateCursor to large datasets?
I am currently having what appears to be a scaling issue with arcpy, da update cursors, and large file geodatabases.
I have a piece of code that iterates through every feature in a feature class and ...
0
votes
4answers
30 views
Generate_arc — Not familiar with its usage and inputs/outputs
I'm using ArcGIS Advanced in order to generate a coverage (I've never worked with coverages before --nor ArcGIS really, know the basics, but not this). I am trying to write a python script to generate ...
0
votes
1answer
16 views
Points Solar Radiation reformat problem
I am trying to produce a set of monthly solar radiation maps based on a monthly parameterization of the diffuse proportion and transmissivity (i.e. new values for both parameters each month). The ...
1
vote
0answers
15 views
Creating sign locations from an existing database with offset & dist to nearest intersection (buffer analysis)?
I have a database of 22,000+ signs that contains the offset from centerline along with a distance to/from the edge of pavement to a specific intersecting road for each sign. I also have a street ...
5
votes
1answer
154 views
How to read an Excel sheet in ArcPy script
I'm writing a python code to convert X,Y points in excel to shapefile. In this process i have toread xy points from shhet1. What is the step i have to include in my process to read data from sheet1 of ...
2
votes
0answers
30 views
ArcPy x64 - Create Enterprise Geodatabase in SQL Server Fails
I'm using ArcGIS Desktop Standard 10.1 SP1 on Windows 7 SP1 x64. SQL Server Native Client 11.0 is installed for both 32 bit and 64 bit. I've also got SQL Server 2012 x64 installed (client tools and ...
3
votes
2answers
57 views
Should Python Add-In installed in map which is packaged be part of *.mpk?
Using ArcGIS for Desktop 10.1 SP1, I just created a map package (.mpk) from a map (.mxd) which had a Python Add-In (.esriaddin) installed.
When I unpacked the .mpk the .esriaddin was neither ...
4
votes
3answers
65 views
Checking if python script is run from ArcGIS (arcmap or on server) or a stand alone python script
For debugging purposes I have created a hardcoded conditional that checks it the script is run as stand alone or as an ArcGIS tool. Is there anyway to fugure this out at run time? e.g. some ...
0
votes
1answer
34 views
How to save a copy of the current data driven page to a new map file?
I need to copy the current data driven page to a new ArcMap Document using arcpy so that I can make sure the file name follows the naming schema that we have defined and the user cannot change. Is it ...
9
votes
6answers
172 views
How to programmatically check if the number of shapes = number of table records?
I have a handful of approximately 1000 shapefiles that are corrupted (see attached error message). The shapefiles were generated from eCognition Developer 8. There is a script tool that seems to ...
1
vote
2answers
46 views
Python script to read coordinate system of an input feature class? [duplicate]
How to read the coordinate system of an input feature class in python script.
How we can use "Describe()" function and tool validator for that purpose
3
votes
1answer
73 views
How to control state of buttons in Python Add-In?
I have bunch of buttons to perform separate tasks within a Python Add-In. Buttons are greyed out and required to be enabled after initial tools run. In the following example, tool1 is turned off after ...
1
vote
2answers
50 views
how to add a raw input to a SQL string?
I have this py script for selecting one point.
# Within selected features, select only those points of a chosen value
arcpy.SelectLayerByAttribute_management("Stations", "NEW_SELECTION", ' "OID" = ...
1
vote
1answer
30 views
ARCGIS10: updatelayer results in error - LayerObject: Get attribute renderer does not exist
I'm quite new in using python in Arcgis 10.
I wanted to use the symbology of a geostatistical layer in the TOC in another geostatistical layer in the TOC. Therefore, one should use ...
0
votes
0answers
38 views
ArcGIS Python Extension - How to Capture Edited Feature in onChangeFeature event
I've built an ArcGIS 10.1 Addin in Python. It is set up and functions properly in ArcMap with simple print commands as the event body.
I'd like to capture the attributes being changed for a feature ...
0
votes
0answers
44 views
Arcpy - loop through subfolders and change mxd settings [duplicate]
I'm trying to run a python script that uses arcpy and os.walk modules. The aim is to find all mxds by specyfying top workspace level only and for the tool to loop through all subdirectories and locate ...
1
vote
1answer
49 views
Improve Python script logic/structure for erasing features with arcpy
EDIT: Too big a question, I think - so, to refine it:
Please help me define (and therefore, research/learn how to use) the Pythonic concept for writing a script that can take one input variable, ...
1
vote
1answer
34 views
How to update attributes of a shapefile using list values?
I am using an update cursor to update the attributes of a shapefile using values from a list. It seems very easy, but I couldn't make it run correctly. When I run the following code, it updates all ...
0
votes
1answer
33 views
Trying (+ failing) to use a Function in Field Calculator
I'm trying to populate a field using a function. When I run this in Pyscripter, it works fine:
d = {}
# Function #
def find_dups(val):
d[val] = d.setdefault(val, -1) + 1
return d[val]
#
...
7
votes
2answers
171 views
How can I speed up my arcpy script?
I have written an application that does a lot of geoprocessing using arcpy. Once started, the application itself runs at an acceptable speed, but it is very slow to boot. It can take 30 seconds or so ...
1
vote
1answer
35 views
ArcPy - Dividing every raster cell value by the maximum cell value
I want to divide every cell of a raster by the raster's maximum cell value using ArcPy. Here is what I have done so far.
densityRaster = LineDensity(shapefileName, None, "", "", "")
maxVal = ...
0
votes
0answers
37 views
Arc10.1: intermittent Error using arcpy.Delete() on temporary rasters
I've been pulling my hair out with an intermittent error when running from either the MS-DOS prompt, PyScripter, or WingIDE. Haven't bothered to check w/in Desktop apps (but a colleague says it's the ...
1
vote
2answers
32 views
Add value in attribute field using arcpy
I need to add value in a field in attribute table, the value is to be determined on the basis of value in another field in same attribute table but i am unable to deifne value in another field in the ...
2
votes
2answers
63 views
How can I perform an inside clip on a raster file based on another raster file?
I have a raster file that I would like to use to perform an inside clip on another raster file. I have tried using the extract by rectangle tool, but it gives me values ranging from 3.40282e+038 to ...
1
vote
1answer
42 views
How do I use the SearchCursor where_clause to get a max value from a column?
This is my first time asking a question on StackExchange. I hope I phrase my question and describe my attempts to understand my problem well enough!
While working with SearchCursor, I'm trying to ...
1
vote
0answers
41 views
Subset a GeoTIFF image into regular grids and extract mean latitude, mean longitude, and mean RGB for each grid
How can I subset a GeoTIFF image with 1000 by 1000 pixels into regular square grids of 50 by 50 pixels (400 grid objects in total); and calculate mean latitude, mean longitude, and mean RGB for each ...
0
votes
1answer
48 views
ArcPy SelectLayerByAttribute Error and how to control GP output layer name
I have a rather long script that first references an SDE feature class (non-versioned) to perform an attribute selection based on a SQL selection. I've been unable to figure out why the script will ...
1
vote
5answers
73 views
String variable substitution in selection expression
I'm trying to put a variable into a string used to do a selection. At the moment it's like this...
expression = "'No_Props' > 5 AND %s < 200 AND 'ST_Ori' >60" % metres_field
...
0
votes
0answers
11 views
how to create datetime from a negative epoch in Python [migrated]
First timer on StackExchange.
I am working with ArcGIS Server and Python. While trying to execute a query using the REST endpoint to a map service, I am getting the values for a field that is ...
1
vote
1answer
47 views
arcpy.CopyFeatures between file GDBs?
I'm trying to figure out why I can't copy a featureclass from one file GDB to another. I can copy the featureclass to within the source GDB. There's no name conflict in the target GDB. I don't think ...
8
votes
1answer
127 views
Where to find and share Python geoprocessing scripts? [duplicate]
Where are folks storing and sharing their Python geoprocessing scripts? For example, I know that GitHub has some shared scripts. ESRI is phasing-out ArcScripts, which is still really handy, and ...
2
votes
1answer
57 views
Python: Change SDE data source for mxds in specific folder
I've searched all the forums and help and have made progess but recently got an error that has thrown me for a loop - also some mxds are not being changed at all! What I'd like my code to do:
Iterate ...