A site-package created by Esri to expose ArcObjects to Python.

learn more… | top users | synonyms (1)

2
votes
0answers
248 views

Cost Path tool in script randomly throws error

I have a script tool that is creating a least cost path for sets of points using a Cursor. When applied, the script runs great, except every so often the tool is stopped because there is an error in ...
2
votes
1answer
361 views

How to replicate an unversioned SDE geodatabase to a file geodatabase?

I need to implement a process for creating a file geodatabase copy (a read-only snapshot, essentially) of a production SDE geodatabase without using versioning, adding global ID columns, etc. I cannot ...
0
votes
0answers
166 views

How to convert shapefile to tpk using python(ArcGIS 10.1)?

I'd like to convert shapefile to tpk using Arcpy.I surf in ArcGIS 10.1 help but i couldn't find any desire reference to help me . How can i convert shapefile to tpk using arcpy ? which function i need ...
6
votes
1answer
159 views

Python in ArcGIS: How to add a space between upper and lowercase letters in TOC

I'd like to use python to update the TOC by adding a space (white space) for layer names that are like this: "BoundaryBuffer" or "WaterEdge" and replace them with "Boundary Buffer" or "Water Edge". ...
3
votes
2answers
265 views

scratch files left behind by arcpy.sa.Con

I have a Con() statement that creates two "extra" scratch files during it's processing, but that do not get cleaned up once the operation is over and the output is saved. r=arcpy.sa.Con(elv, ...
4
votes
4answers
400 views

How to rename a file in the output (ArcGIS python)?

raslist=arcpy.ListRasters() for ras in raslist: arcpy.ProjectRaster_management(ras,outfolder2+ras+'_Albers',spatialref2) print ras+' has been reprojected' I was using the above code for ...
2
votes
3answers
341 views

ArcPy(10.1) distanceTo using dynamic geometries?

I am struggling to get the arcpy point class method distanceTo to function with dynamically generated geometries with a Python addin. I have used the default tool addin function and set self.shape ...
4
votes
1answer
146 views

How to implement multiprocessing with multiple geoprocesses?

I am relatively new to Python and thought I would give a stab at multiprocessing. I have a script that runs well in IDLE or as an ArcMap toolbox script. After perusing these forums and docs.python, I ...
3
votes
2answers
627 views

Append or merge consecutive line segments (contours) as one single line of the same elevation value

Is there a way using python (ArcPy) or ArcGIS 10.1 tools to collect consecutive line segments having the same elevation value and appending/merging/generating one single line from them? Each resulting ...
3
votes
1answer
300 views

'Pausing' a Python script tool to allow the user to provide input before continuing

I am using ArcGIS. I have written a Python script that creates various surfaces including NDVI. After the script creates those surfaces, I would like the script to stop running while the user ...
0
votes
0answers
79 views

Copy Raster Catalog from .mdb to .gdb, but only within a certain extent with arcpy?

I am stumped again, this website has really helped me before so here is another shot. I am trying to copy a raster catalog from a personal geodatabase to a newly created file geodatabase but only ...
2
votes
1answer
964 views

How to add feature class to MXD with ArcPy (Python)?

I am using ArcGIS 10.1 and I am trying to add a feature class that I create to an MXD, so that I can join to it. This all needs to be done using Python. Is this possible?
3
votes
2answers
154 views

Detecting ring direction of a polygon using ArcPy

I am using ArcPy in ArcGIS 10.1 to process some geometry using the arcpy.da data access module. However I have run into a problem with complex Polygons that contain inner rings/holes. From the ...
1
vote
2answers
323 views

How to write raster field values into attribute table using ArcPy?

Is it possible to use ArcPy (10 or 10.1 )to write raster field types into a featureclass? either SDE or filegeodatabase?. I'm hoping to use arcpy as means of automating the process of adding rasters ...
10
votes
2answers
541 views

Is there a compelling case to learn/use Python Toolboxes (new at ArcGIS 10.1) over Python Script Tools?

I've written a few Python Toolboxes (which are new at ArcGIS 10.1), but am yet to decide whether/when I should write them rather than Python Script Tools in a standard toolbox. I thought the Online ...
4
votes
1answer
816 views

How to reduce time for 'Export to PDF' (or any other alternative to print maps) in Python?

For my work, I designed a tool to create PDF maps with large amount of data, intersected with 5 buffer rings using ArcPy. The job involves intersecting points, selecting points, generating Elevation ...
3
votes
1answer
172 views

How to get default parameter value for script tool from csv file?

I am fairly new to python scripting. I have just figured out how to read and write input parameters for a python script from a csv file. Now I am being asked to pre-populate the script tool dialog in ...
1
vote
2answers
124 views

Python select by attribute using a variable counter

I am brand new to python and trying to learn how to do some simple loops but I have hit a snag. Below is what I am working with, I am trying to select the polygon row by row, but I keep getting EOL ...
7
votes
3answers
378 views

can arcpy detect whether it's running in Desktop or Server?

I'm developing some code that I want to run both as an ArcGIS Server web service and as a standalone script. I want to be able to modify the execution slightly depending on whether it's running as an ...
0
votes
2answers
138 views

ListFeatureClasses brings back more than expected

Why, when I issue the function: fcList = arcpy.ListFeatureClasses(feature_type='point') does it bring back a list of grid/rasters as well as all my point featureclasses from ArcSDE. All I want is ...
0
votes
0answers
647 views

insert cursor and arcpy.da.editor

I am trying to insert geometries and attributes to a featurclass the has attachments enabled. The featureclass is in an sqlserver SDE 10 database with service pack 2 installed and the featureclass is ...
4
votes
2answers
1k views

How to copy selected (targeted) features to new shapefile using ArcPy?

I'm trying to copy specific attribute table rows from one shapefile to a new shapefile that will contain only the specified rows in its attribute table, that is, if a field GDP_TOP10 = 1. I'm using ...
1
vote
2answers
143 views

Python: Arcpy: Adding data to a shapefile

Complete arcpy beginner here... I have a shapefile with the fields CNTRY_NAME and GDP_HEAD. I have a list in Python gdppop2002 = [['Country1, 234.1232341], [Country2, 23.2341234],...etc...] I'm ...
2
votes
1answer
564 views

Why does copy convert my Tiff raster value range?

Recently I have worked with some raster dataset. And I found there are different kind of raster dataset. Till now I have worked with grid type raster dataset and my add-in works fine with this type. ...
7
votes
1answer
593 views

ArcPy method to determine ArcMap document version

Is there a way with ArcPy to identify the version of a Map Document (MXD). I am working on a solution to inventory our MXD's and would like to know if a document is 8.1, 9.2, 10.0, etc. I am ...
1
vote
1answer
309 views

Creating an Origin/Destination (OD) cost matrix using ArcPy

I have created a python script that runs an OD cost matrix over five years from 1999 to 2004. I have set up an OD cost matrix for each year, which I think is very cumbersome. Is there someone who can ...
1
vote
0answers
265 views

Python Addin toolbar- Environment mask parameter not being recognised?

I've created a button on a python addin toolbar which uses the selected features from the selected layer in the TOC, creates a feature layer from that selection and uses that feature layer to set the ...
2
votes
2answers
98 views

How to reproject all featureclasses in a database to another database?

I am very new to arcpy and have ArcGIS 10.0 I would like to make a script where I would only have to change two variables in a script (database_input and database_output) so that I can reproject all ...
0
votes
1answer
267 views

Apply Symbology to a group layer

I currently have around 200 features that all need have the same symbology applied to them. I have used the ApplySymbologyfromlayer_management however this takes much to long to process, at least a ...
0
votes
0answers
56 views

Pyscripter hangs on spatial join?

I've got a script which loops through a series of FC layers (tracker points). Using a FOR loop, they're reprojected then joined to a streets layer. Sometimes it works fine, then other times it never ...
6
votes
4answers
1k views

How to check via Arcpy if ArcMap is currently in an edit session or not?

I've created a Python add-in button that helps speed up my coworkers workflow by copying one feature class attribute to another. It uses the arcpy.UpdateCursor function to update a row in the target ...
1
vote
1answer
194 views

OD cost matrix Arcpy [closed]

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 ...
2
votes
1answer
168 views

How to catch invalid expression errors in Python?

I have a script that creates a new feature using arcpy.GetParameterAsText, but I'm having trouble creating an error message for incorrect user input. The input for a parcel # should be something like ...
1
vote
2answers
373 views

ArcPy Field Calculation with special characters

I'm trying to calculate a string field, using "µSv/h". Running this in the manual field calculator works just fine, but I've tried this in the Python window in ArcMap as well as the IDLE, but both ...
2
votes
2answers
325 views

Python Code: “Compare two fields and select missing records”

The code I wrote is not right!! It's selecting more than what is actually missing. I think I'm wrong on the matched code line. I need the script to make a list of the "FLAG" field and a list of the ...
1
vote
2answers
228 views

Polyline will not turn into a feature layer via MakeFeatureLayer_management (arcpy)

I've got a python script that is connecting a sequence of points to make lines (script is based on answers to my previous question). To attempt to make subsequent processing more efficient, I would ...
6
votes
1answer
486 views

How to add layer with ArcPy and retain feature class metadata (like Credits) in layer properties?

I have multiple feature classes in a geodatabase, each feature class has metadata including a Description, Credits, and other information. If I use the 'Add Data' button in ArcMap 10.1 to add one of ...
1
vote
1answer
266 views

mosaic raster to file geodatabase yields missing raster sections

Since upgrading to ArcGIS 10.1 (SP 1) from 10.0, I've been encountering an issue when running the arcpy.MosaicToNewRaster_management() tool with output to a file geodatabase. I'm principally working ...
1
vote
1answer
72 views

Feature to Line on feature selections with ArcPy

I'm trying to collapse parallel polylines (dual carriageways in a shapefile of roads) to single centrelines. I'm aware of cartography's dual lines to centerline tool, but I find Feature To Line (Data ...
2
votes
0answers
512 views

Fixing “spatial index grid size is invalid” without Recalculate button

I've got a python script that is connecting a squence of points to make lines, and putting them into a feature class (based on answers to my previous question). It works wonderfully on a small area ...
2
votes
2answers
277 views

Errors using SelectLayerByAttribute in ArcPy

I cannot for the life of me persuade SelectLayerByAttribute to work (I need to automate this for a complex script). Working in ArcMap's python console on already loaded shapefile, the format below: ...
2
votes
1answer
123 views

Reporting Engines used with ArcGIS Server

I'm curious what others are using to build the more elaborate reports out of ArcGIS Web API apps? By elaborate I mean ones that include lots of dynamic charts and tables, multiple maps/data frames ...
0
votes
1answer
398 views

Can an arcpy.da.SearchCursor be used on a dataset residing in a ParcelFabric?

I'm using ESRI's LocalGovernmentMI.gdb data model and am managaing parcel data in a ParcelFabric dataset. I'm trying to use a search cursor on the ParcelFabric_Parcels dataset but I recieve this ... ...
8
votes
1answer
167 views

Difference between python window and toolbox

Are there differences in performance or other potentially critical area between running a python script in the python window versus running it from the toolbox in ArcGIS 10.0? I am asking in cases ...
1
vote
2answers
78 views

Select individual lines from feature class, convert to unique rasters: “raise e” error?

I have a feature class with 5 lines in it, and need select each one and turn them into its own raster -- for example, line 1 is raster 1, line 2 is raster 2, etc. This is the python script: import ...
2
votes
2answers
368 views

Run Python child script using Python Add-In button class?

I have a Python script which I want to execute using Python Add-In button class. Right now, I am using following: class child(object): """Implementation for Toolbar_addin.button2 (Button)""" ...
13
votes
1answer
297 views

Watermarking photos using their geotag and create a shapefile

I have geotagged photographs and I would like to place a watermark of the photos location on the front for easy reference as well as creating a shapefile from the coordinates. Does anyone know of any ...
0
votes
1answer
441 views

UnboundLocalError: local variable referenced before assignment

I have following simple function to get percent values for different cover types from a raster. It gives me following error: UnboundLocalError: local variable 'a' referenced before assignment which ...
0
votes
0answers
195 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
691 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 ...