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

learn more… | top users | synonyms (1)

2
votes
1answer
140 views

Importing arcpy on application launch to speed up subsequent arcpy methods

Is there a way of importing arcpy during the launch of my custom built application so that any usage of arcpy methods after the fact won't require the 3-4 seconds that it takes to import the arcpy ...
9
votes
2answers
533 views

Generate near table for x number of neighbours using arcpy

There are 3 likely scenerios that I am trying to capture near distances for: An interchange subway station, which has 2 or more neighboring stations. That is, the station in question connects 2 or ...
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 ...
1
vote
1answer
1k views

SImple model works, resulting script doesn't

The goal is to convert an XY layer (from Excel) into a feature class. The "MakeXY" portion works flawlessly, the arcpy.FeatureClassToFeatureClass_conversion portion inevitably returns a 999999 "Table ...
4
votes
2answers
910 views

How should I go about calculating the centroid of several lat long points in python, and perl?

Calculating the centroid several time on a number of geographical points. I was wonder is there a perl or python module that could make my life easier when working with large datasets of lat long ...
4
votes
2answers
886 views

Set Data Driven Scale from Arcpy

Is there a way to set the data driven scale from arcpy? Looking at the documentation for the DataDrivenPages class, it doesn't seem to be accessible from outside of ArcMap. The script I run within the ...
2
votes
2answers
3k views

arcpy.Delete_management not deleting a geodatabase folder

This script runs fine the first time but fails when run the second time. The issue seems to be that the KMLToLayer_conversion statement creates a file geodatabase (no surprise) that subsequently ...
1
vote
1answer
695 views

Replace data source of layer in ModelBuilder

After reading through the documentation about MapDocument and Layer classes, I have been trying to use the replaceDataSource method in ModelBuilder to replace the data sources of certain layers within ...
7
votes
3answers
457 views

Remove username and password from saved arcgis layer (.lyr) files?

How can one remove the saved username and password from ArcGIS layer (.lyr) files? A scripted solution preferred but even a point and click method will be welcome.
4
votes
2answers
1k views

Field calculation- Arcpy

I am developing a script to calculate the values of two fields (C and D) based on value of field A (It is a Point feature): A C D 0.2 1 1 0.2 1 2 0.2 1 3 0.4 2 1 0.5 3 1 0.5 3 2 So the idea is n ...
4
votes
0answers
528 views

ArcGIS Cost Path Analysis - How Is Arcpy Cost Path Analysis Tool So Much Faster Than ArcObjects

Although I love slinging some python to create geoprocessing scripts/services, I was under the impression that using ArcObjects to do the equivalent operation(s) will have better performance. I've ...
4
votes
1answer
910 views

Export and edit annotation featureclass using arcpy

I would like to convert labels to annotations and make some advanced editing for these labels using ArcPy. How would I do this? I'm using a file geodatabase and ArcMap 10. Any help, please.
0
votes
1answer
238 views

ArcGIS Server GP Service - RasterIO.dll crashing ArcSOC.exe

I've been having a terrible time this week turning some very simple geoprocessing scripts into gp services on ArcGIS Server 10 SP 4. In the case of the linked post, I found that using certain raster ...
4
votes
1answer
320 views

Counting and Storing Event Data Contained Within a Polygon (Using Python)

I have a fairly large project and I would like to automate some tasks using Python. Problem is, I don’t have any experience with Python for ArcGIS. And I rarely use ArcGIS until something big like ...
2
votes
2answers
762 views

ArcGIS Geoprocessing Script runs fine in Desktop but crashes as Geoprocessing Service?

I have a small and simple geoprocessing script that I am trying to expose as a geoprocessing service in ArcGIS Server 10 SP4. The script is below. Pardon the hard-coding... With the hard-coded ...
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 ...
4
votes
2answers
5k views

Arcpy - How do I specify the precision and scale of a new field?

I'm wanting to create a field with a maximum of 1 decimal place and then calculate a value into it: (I know that all my values are < 10) arcpy.AddField_management('C:/shapefile.shp', 'myField', ...
3
votes
1answer
393 views

Update Arcpy version?

This is probably the answer to my previous question. The version of arcpy that I am using does not include GetNAClassNames naClasses = arcpy.na.GetNAClassNames(serviceAreaLayer) ...
0
votes
0answers
163 views

Export Data Driven Pages extents to Kmz

Is it possible to export the extents of DDP to KMZ using arcpy - Map to KML (Conversion)? Alternatively can we export each extent of a single DDP extent to a new mxd and then run arcpy.MapToKML_3d on ...
1
vote
1answer
77 views

Is there a way to access ps.map in python?

i am wondering whether its possible using python interface to load layers and edit them in Print/Cartographic Composer without displaying, and finally export to PDF? something that can be done via ...
6
votes
0answers
435 views

Land Classification with Spectral Python (SPy) [closed]

Does anyone have experience working with the Spectral Python module for land classification? The following k-means clustering example takes an iterative approach to classification through pixel ...
3
votes
1answer
316 views

List Elements or Datasets of a given Layer

I am sorry of this might sound like a noob question but I cannot find any answer from google. I used arcpy to do batch processing of Network Analyst - Make Service Area layer of thousand of stores. ...
3
votes
2answers
517 views

How to select polygon features that have their centers outside of another polygon feature class

Since I only have Incorporated area feature class, how can I select census blocks that are in unincorporated area? Or not within any incorporated areas? Thank you. John
4
votes
4answers
799 views

Is there a way to programatically force RGB (3 bands) in a raster with arcpy?

I'd like to include conversion to a 3 band RGB raster in a script to prepare multiple DEMs for image processing. The input files are rasters extracted from a raster mosaic. The manual option is to ...
3
votes
1answer
301 views

How do I stop GP script from adding temporary data to Table of Contents?

I have a script that does a series of calculations, producing temporary data along the way. However, at each step of the script, data is added to the TOC and then removed when I call the ...
10
votes
2answers
2k views

Methods for optimizing multcore processing in ArcGIS

I am interested in learning methods to utilize the full extent of multicore processing power available on a desktop computer. Arc states that background geoprocessing allows the user to utilize ...
3
votes
1answer
329 views

Batch Sum Fields Script

I have created a python script that batch summarizes all string fields within a fc table based on the concatenation of two fields. The script loops through a list of the fields, however it stops ...
4
votes
2answers
1k views

Running ArcPy script from ArcObjects?

the standard method requires to run ArcPy script in command line, i've struggled with it to run but without a result, i can import arcpy, set the workspace to the geodatabase path and describe the env ...
3
votes
1answer
222 views

Create Array From Selected Features Based on the Order in Which They Were Selected

I need to create an array of features from a selection based on the order in which they were selected. As in: I select feature 5,2,3,4. I need to have an array so I can apply attributes (with python) ...
4
votes
1answer
352 views

Controlling time slider using arcpy

I am trying to control the time slider object through my code in the python console. As given in couple of examples, the time property of a data frame could be controlled by Data frame time property. ...
3
votes
1answer
786 views

Python scripts runs from PythonWin but not ArcCatalog (ArcGIS 10)

I add a field to the target FeatureClass it is not present, via arcpy.AddField_management(...). Works fine from PythonWin, but the AddField call fails when the script is run from ArcCatalog. I have ...
3
votes
3answers
2k views

Convert an .xlsx datasheet with point feature data into a POINT feature class

I am trying to create a script tool to automate this process, eventually it will be used for batch processing but at the moment I can't even get test data to work. This is pretty basic at the moment, ...
8
votes
2answers
612 views

Creating summary table of symbology of all datasets in multiple MXDs?

This is related to the following Retain ESRI symbology in Mapinfo TAB . As an initial step (in arcpy) I want to access the symbology of all the datasets and create a document which has the details of ...
3
votes
5answers
1k views

Having trouble nesting updatecursors

I'm trying unsuccessfully to perform updates on multiple linked tables using updatecursors. The following code works as I would expect: trackRows = ...
4
votes
2answers
1k views

Getting the Field Alias from a layer, from within a Map document

I've got a very simple script, that loops through all the layers in a mxd and loops through the fields, and prints out the Alias Name for the field, but I am having some problems, it seems to be ...
8
votes
4answers
287 views

Subset Folder Contents ArcPy

I have about 1500 .txt files within a folder named 3410001ne => 3809962sw. I need to subset about 470 of these files to process with a Python script. Below is the section of code prior to my for ...
2
votes
1answer
831 views

Adding Layer in current session using ARCPY

I wanted to add a layer through the toolbox using arcpy. The below script works fine through the python console in ArcMap, but does not when executed through the toolbox. The layer flashes for a ...
7
votes
3answers
4k views

How to delete feature class features faster (ArcPy)

I have written this script that recurses through all feature classes in a given set of feature datasets and deletes all their features. It appears to do the job but it runs pretty slowly. Is there ...
2
votes
1answer
701 views

Snapping lines to points

I have a layer containing a vector 'Line 1', that originates at point 'A' on a second layer. I also have point 'B' on a third layer. I want to create 'Line 2' that has the same angle and length of ...
5
votes
1answer
1k views

Move .SHP from .MXD to gdb [duplicate]

Possible Duplicate: How to move SHP to gdb with ArcView license? Let's cut it short, I have numerous mxd with layer coming from .SHP and various servers WMS that I need to move to a gdb. ...
4
votes
2answers
881 views

In ArcPy, how can I save a clipped raster dataset to memory (not to file)?

I've been trying to clip a larger raster dataset by a polygon extent, where the resulting clipped raster dataset is saved in-memory. So far, my attempts produce vague errors. >>> ...
1
vote
0answers
596 views

Variable stored as NoneType in Python with updateCursor

SOLVED: although the field was not nullable (no null values), a glitch created one in the heading field, so the variable was stored as a null value and thus the NoneType. I am using updateCursor to ...
2
votes
1answer
116 views

Generate a global view Image of where a Lat-Long location is

I would like to automatically generate an image which highlights a location from a global view. Here is an example of what I would like to achieve: I am debating using python utilities such as ...
7
votes
3answers
6k views

How to include variable in where clause of arcpy.Select_analysis?

I am trying to loop through a shapefile, selecting each feature in turn and copying it to a temporary shapefile to by included in a union analysis. I'm using a cursor to find the ID name for each ...
9
votes
2answers
726 views

Check validity of file geodatabase using arcpy

AS the title suggests, how can I whether a GDB file is valid using arcpy? One approach is, only checking the whether the name ends with .gdb, but that's not a robust approach. Because a normal file ...
4
votes
1answer
1k views

How to rename large amounts of spatial data?

I have approximately 1500 raster files following this format: m_3609922_nw_14_1_20100425 I need these subsetted to, for example: 3609922nw. What are appropriate methods to rename large numbers of ...
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 ...
6
votes
3answers
3k views

Does ArcPy have a spatial search function for geometry?

My problem: Using ArcPy I want to loop over buffers and select geometry_features inside each buffer and do something (update) only the objects found within that specific buffer. The code below ...
4
votes
2answers
2k views

Python method for finding a substring within a string

I converted a KML to a feature class and no longer have access to the symbology set in the original KML. I'm trying to re-create this by creating a new field that stores identifying information ...
4
votes
1answer
258 views

How to dynamically view Python script results in ArcMap?

I want to view the output of arcpy scripts (run in Python IDLE) in ArcMap. I tried refreshing the ArcMap data frame after I run the script. This does not work. Please advice me on this.