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

learn more… | top users | synonyms (1)

3
votes
2answers
380 views

Accessing geometry with SearchCursor in ArcPy

I'm trying to write a script that clips all feature classes in fcList by the successive rows of a clip feature. I'm using arcpy with ArcGIS 10.0 The problem is that I need to verify whether the ...
3
votes
2answers
279 views

How to convert polygon singleparts to multipart?

I am interested in converting a polygon featureclass created via Create Fishnet (Data Management) from singleparts to multipart. QGIS has a very handy tool called singleparts to multipart that does ...
3
votes
2answers
125 views

Create a buffer with a pre-defined area?

I have a road (line) system and need to create a polygon from it to show the right-of-way area. The right-of-way area is calculated in the field from taking measurements from the road centreline. From ...
3
votes
2answers
1k views

Python script to export .csv tables from GDB

I am very new to Python programming and have been tasked with writing a program to export a csv file from a file geodatabase feature class. The csv should contain only certain fields and the records ...
3
votes
1answer
570 views

How can I rename multiple feature classes (each different name) using Python?

I have a geodatabase including (cnty06,cnty07,cnty08,cnty09...) that I'd like to rename to (c06,c07,c08,c09...). I can use the ModelBuilder (or script from ModelBuilder) to complete this task. Is ...
3
votes
1answer
507 views

Can arcpy.env.workspace be set multiple times in same script?

Is it possible to set arcpy.env.workspace multiple times in the same script to ListDataFeatures from different workspaces? eg. import arcpy def readFromGdb(): arcpy.env.workspace = ...
3
votes
1answer
205 views

Multithreading in Arcpy

I am learning multithreading and thinking about using it with Arcpy. The example I am working on doesn't have much practical reasons. However, I don't know why it fails on the line ...
3
votes
1answer
2k views

Using ArcPy update cursor to replace <Null> value?

I have been combing the help associated with (None) values in arc, and have not been able to solve the following problem: I have a a field with mixed Null and integer values: 0 100 I would like ...
3
votes
1answer
2k views

Getting the name of the mxd using python

I have a python script which reads through all the mxd's in a folder and changes their properties from relative file paths to absolute file paths. I now want to add a bit to the script to change the ...
3
votes
3answers
755 views

How to release locks to temp files after ArcPy script crashes in ArcMap?

Sometimes when I'm testing an ArcPy script and it ends with exception, ArcMap is still holding locks to some temp files (I run my scripts through ArcMap). I cannot run the script any more, because it ...
3
votes
1answer
517 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 ...
3
votes
2answers
139 views

Can MakeFeatureLayer Object be Passed into ExportReport Function Layer Parameter?

I'm trying to pass an in memory layer object created from a feature class using Code: arcpy.MakeFeatureLayer_management() into the Code: arcpy.mapping.ExportReport() function. It's erroring out, ...
3
votes
1answer
693 views

How to access all mxd files in a folder?

I'm a beginner to Python and am trying to figure out how I can access several mxds in a folder. For example, when I want to use the AnalyzeforMSD function in ArcGIS: import arcpy mxd = ...
3
votes
3answers
1k views

How to measure minimum distance between objects in two layers using arcpy?

I am working on an alien species analysis looking at the spread of a species from the mainland to islands in an archipelago. I am doing the analysis using arcpy and I have succeeded in isolating risk ...
3
votes
1answer
467 views

Pasing multivalue parameter using arcpy

I am trying to get my head around how multivalues derived from the arcpy command GetParameterAsText gets looped through a script. Could some please provide a sample script that does the follow basic ...
3
votes
3answers
2k views

Create an ArcCatalog OLE DB Connection using Python

Is it possible to create an OLE DB connection (*.odc) to a database in ArcGIS 10 , but using Python instead of the ArcCatalog GUI wizard? I don't need to necessarily create a file on disk, just make ...
3
votes
1answer
1k views

Add multiple fields in attribute table

How do I add in multiple fields in the attribute table? In the attribute table I have crop types such as corn, cotton, sorghum....etc (as shown image below), in square meters. and I want to generate ...
3
votes
1answer
2k views

Use ArcPy to rename MXD layers

I have a MXD with some layers that have parentheses in them. I'd like to rename them via script. Is this a valid approach? import re map = arcpy.mapping.MapDocument("CURRENT") layers = ...
3
votes
1answer
1k views

Sorting shapefile records on attribute to update new rank field using Python?

Basically, I am trying to sort the records within the shapefile based on an attribute(eg: pop) and then add a new field that indicates ranking based on the sort. eg: the record with the highest pop ...
3
votes
3answers
2k views

Geoprocessing with ArcGIS Server 10.0 - %scratchworkspace%

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Key_concepts_for_geoprocessing_services/002v00000002000000/ I'm trying to have a new GP Service arcpy.AddMessage() the scratchworkspace ...
3
votes
2answers
1k views

Is it possible to get arcpy on 9.3* or Qgis? Or maybe some of the functions?

If this isn't possible what would be the closest equivalent open source? Could parts of the module be ported to work on 9.3 or QGIS? I'm not sure if this would infringe on the license porting for 9.3. ...
3
votes
1answer
65 views

Using arcpy to find geometry within another feature

In Arcpy, I would like to start with a point and then using its geometry method to find out if it is inside my polygon feature (Urban Areas) deeper than the buffer distance. This is a follow up to ...
3
votes
4answers
86 views

Python Script create spreadsheet with exception

In the following Python Script, I would like to create a spreadsheet (Excel would be fine) with the Exception results instead of just printing "There was an error--->..." to be able to keep track of ...
3
votes
2answers
255 views

How to calculate a value based on another field under arcpy.da.UpdateCursor and cursor.updateRow?

I am trying to do a calculations under arcpy.da.UpdateCursor. I want to calculate the values for the records that have FIPS=06037. I want to take the values from "kg" column and populate the new value ...
3
votes
1answer
121 views

ArcPy delete terrain: cannot be deleted

I can't get my ArcPy script to delete a terrain. If it exists, it should be deleted. However it throws an ERROR 000317: {path} cannot be deleted My script is a lot longer than this, but this ...
3
votes
2answers
158 views

Calculate field values using random integer derived from count of like features

I have a feature class which contains features classified by type. What I would like to do in my new field is generate a random number sequence for those like values using a count of the like values. ...
3
votes
1answer
2k views

64 bit Python on ArcGIS 10.2.2 for Desktop

I am trying to have Python 64-bit with ArcGIS so that I can use my entire RAM when doing data analysis. Apparently ArcGIS 10.2 Desktop comes just with 'Python 32-bit'. Should I install a fresh Python ...
3
votes
1answer
61 views

Does Avenue equivalent of pointPosition exist in ArcGIS 10.2?

There were a couple of awesome methods in Avenue for ArcView: point=polyline.Along(percentage) percentage=polyLine.pointPosition(point) Don't laugh, but one of the reasons I updated to 10 from 9, ...
3
votes
2answers
782 views

Using multiple wildcard parameters with arcpy.ListFeatureClasses

I know there has to be a way to do this but I'm having trouble figuring out how to do so. I would like to create a list of feature classes to perform operations on however, I want to have the list ...
3
votes
1answer
220 views

ArcPy / ArcMap 10.2: How to report data to user?

I'm developing an arcpy addin with ArcMap 10.2 that outputs a feature layer based on user input. How can I display attributes from this layer in a MessageBox or other reporting mechanism? I don't ...
3
votes
1answer
240 views

AddJoin failing in Python ArcGIS [duplicate]

My AddJoin operation is failing: arcpy.CopyRows_management(lup_file,out_dir+'lup') try: # Perform copy rows on merged csv file print 'start' aa = arcpy.Raster(SEIMF) ...
3
votes
3answers
797 views

Why does import arcview/arceditor give gp.setProduct() RuntimeError: ERROR 999999: Error executing?

I am developing a script that will be used in ArcGIS Desktop 10.2 of Standard (formerly called ArcEditor) license level and thus importing arceditor to make sure I don't use GP tools that require ...
3
votes
1answer
331 views

Using update cursor in a while loop to perform analysis on individual polygons gets stuck on first row

I am working through an open courseware project from PSU found at https://www.e-education.psu.edu/geog485/node/145 I am trying to use an update cursor in a while loop to perform an analysis on ...
3
votes
1answer
69 views

Can I access the Error Log in arcpy?

Can the error log created by validate topology be assessed through arcpy? I can validate the following topology - arcpy.ValidateTopology_management(r"C:\WorkSpace\CWD.gdb\FD\FD_Topology") Can I ...
3
votes
2answers
142 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 ...
3
votes
2answers
1k views

arcpy Problem with updateRow() when trying to update fields with UpdateCursor

I have a list of values which I am trying to add to an existing shapefile. The field where the values need to be inserted has been added via arcpy.AddField_management and thus the values of the rows ...
3
votes
1answer
669 views

Getting unicode encode error in ArcPy/Python script?

When I am running a script (it checks to which database a mxd is connected) I get the following error: return codecs.charmap_encode(input,errors,encoding_table) UnicodeEncodeError: 'charmap' codec ...
3
votes
2answers
735 views

How to filter out multipart polygons and then buffer?

I've written a small script trying to accomplish the task described in the question title. It basically looks like: in_fc = '...' # Some shapefile goes here # Get the fields (column names) of the ...
3
votes
2answers
3k views

How do I use python to batch process the reprojection of a group of shapefiles?

My client would like his shapefiles reprojected and I would like to get a script that can batch process all the files located in the same folder. I am new to Python and ArcPy but am very interested. ...
3
votes
3answers
2k views

How do I access a multivalue output parameter from a python script in modelbuilder in ArcGIS 10.0?

How do I access a multivalue output parameter from a python script in modelbuilder, in ArcGIS 10.0? That is, I have a python script that loops through several input layers (working through a script ...
3
votes
1answer
1k views

ArcPy: Feature class “doesn't exist” after MakeFeatureLayer

I was working on a Python script to analyze the geometries of a feature class and write something out. It worked fine the first time, but gave an IOError each subsequent time. I narrowed the problem ...
3
votes
2answers
3k views

Selecting features through arcpy

I would like to achieve the following functionality through arcpy: Querying an existing baselayer on time and create a new layer Apply symbology from an existing layer and add the new layer to the ...
3
votes
3answers
864 views

Merging edited data back into ArcSDE master geodatabase?

I need some suggestions/inspiration for a problem we have. The problem: We have an ArcSDE master GIS database. We will edit this data almost exclusively outside of ArcGIS and outside of ArcSDE. In ...
3
votes
1answer
687 views

ArcGIS Select Analysis using Unique Values from Field

I am trying to create separate shapefile using Select analysis with ArcPy by doing an SQL query to create them based on a unique value from the field. I want to create a list of the unique values in ...
3
votes
1answer
1k views

How to change the datasource with python?

How do I change the datasource of all layers in a map document using arcpy and python
3
votes
1answer
94 views

How do I import specific fields from a shapefile?

Using arcpy, how do I import only select fields from a shapefile? Or, if I must import the entire shapefile, how do I delete certain fields after import?
3
votes
2answers
99 views

Adding descriptions to feature class in a geodatabase using arcpy

I am trying to populate the properties of a feature class in a geodatabase using arcpy. In the past I have been given geodatabases with features classes that already have their property descriptions ...
3
votes
2answers
188 views

Finding the Python script used by a custom toolbar button in ArcMap

I've been asked by somebody at work to design a toolbar add-in that works just the same as an existing one, but with a different set of data. However, the person who wrote the original add-in for him ...
3
votes
2answers
507 views

ArcPy Data Access Insert Cursor not writing geometries to feature class?

I'm running ArcGIS 10.2.1 and am having troubles with the Insert Cursor in the arcpy module. I have an empty feature class in my geodatabase and have created the short script below to try and find the ...
3
votes
2answers
143 views

Importing external bookmark (.dat) files into many MXDs using arcpy?

Does anyone know any python script to use for arcview to import a bookmark (saved as a .dat) that was created and saved externally using ArcMap? I tried with this script but without a result: import ...