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

learn more… | top users | synonyms (1)

5
votes
1answer
3k views

How to programmatically add shapefile to data frame in Arcmap

I have a toolbox with python script which creates a shapefile from JSON txt file, but it does not show the generated shapefile in arcmap, i have to add it from the output location. What code shall I ...
0
votes
1answer
483 views

Defining projection in arc toolbox (JSON to shapefile) in python

I have a arc toolbox which converts JSON txt file to a shapefile but we have to define the projection. How can I hard code the defined projection so that user don't have to input the projection ? ...
1
vote
2answers
2k views

How can I save raster dataset using arcpy

I'm trying to save filled raster object to geo database by my specified filename. import arcpy from arcpy import env from arcpy.sa import * env.workspace = r"C:\GIS ...
3
votes
4answers
2k views

Arcpy Max Value per Group in One Field

I have a point shapefile that have two attributes that I want to extract from them. These two fields are "Group" and "Distance" I want to grab the maximum "distance" from each unique number in the ...
3
votes
1answer
890 views

How to create an offset polyline in arcpy?

I am trying to create an offset polyline using arcpy, identical to the function in ArcObjects (constructoffset). After trying to access ArcObjects in arcpy, which I found difficult for those not ...
2
votes
0answers
93 views

network related issues arising when running an arcpy script

Essentially I wrote an arcpy script that is within a toolbox that I ported over to a different machine to test out after the script worked locally. The script essentially utilizes the psycopg module ...
0
votes
1answer
622 views

Testing if shapefiles intersect from a list using intersect: ArcGIS

I am new to programming and scripting in general, so please bear with me. I have generated a list of the location of all the shapefiles for my workplace. The files are all placed in folders, no ...
1
vote
1answer
143 views

Button that allows project search and zooms to site once executed

I am trying to create a button that will execute a Python script. I have limited Python experience. What we are trying to accomplish is to recreate these steps: Query on project Site and Radius ...
1
vote
2answers
747 views

How to automate relative filepath when adding a new toolbox to the arcmap catalog?

So I'm creating an arcpy script for a custom toolbox and I want to make it so that a user can essentially utilize the script in that toolbox without having to change the source path (which I made ...
5
votes
2answers
894 views

How to check if domain already exists?

I am trying to check the existence of domains in my file geodatabase which contains 4 domains (automatically populated after I created some annotation feature classes). My code is as follows: import ...
4
votes
2answers
2k views

Check if shapefiles exists in folder

In ArcGIS modelbuilder I want to check if a shapefiles exists, if not I want to create the shapefile in that folder. I guess the calculate value tool within ArcGIS modelbuilder can be used, but I need ...
2
votes
2answers
596 views

How to truncate file geodatabase tables with python?

Everything is in the title. I need to truncate file geodatabase tables (1 or all) with python. What is the code for that? Thank you in advance!
4
votes
3answers
1k views

arcpy join field tool is not licensed

I am using ArcGIS and arcpy to process some shapefiles. When I try to use the function arcpy.JoinField_management() the program stops and Python says that the tool is not licensed. This confuses ...
4
votes
2answers
800 views

How to use Matplotlib in Python 2.6 installed by default ArcGIS 10.0 installation?

I am wondering if anyone has successfully run Matplotlib with the default installation of Python 2.6 that comes Arcgis 10.0. It does not seem to work with the python version installed by Arcgis 10.0. ...
1
vote
1answer
747 views

arcpy: creating polyline features from the following text file format

I am looking into a way of reading the following file format with python, where 0 0, 0 1, 0 2, ect... is the polyline object number and 0(1) 464736.1645 260940. 098377 are x, y coordinates of ...
1
vote
1answer
905 views

ArcGIS Python Script Tool Validation: Control Overwrite Behavior

I'm creating a script tool to read the USGS earthquake GeoRSS feeds. It works fine as a script with hardcoded values. The script also works fine as a tool for creating a new feature class for a given ...
5
votes
2answers
3k views

ArcGIS 10 Python script to search directories and subdirectories for intersects and clip them

I'm trying to develop a tool that queries our company's data stores for any data that intersects a feature. So when we acquire a new property we can run this tool and it will find all of the data we ...
4
votes
2answers
532 views

ArcGIS Spatial Join Options Missing

The ArcGIS SpatialJoin online help page has a long list of match_options when joining data spatially, including HAVE_THEIR_CENTER_IN. However running the arcpy.SpatialJoin_analysis tool in Python ...
4
votes
2answers
2k views

Arcpy Insert Cursor not inserting all rows

Good morning all, I have a script here that takes data from a cross-tabulated non-spatial dataset where monthly values are stored in a single table row for a given year and linearizes those data so ...
5
votes
2answers
727 views

Create a polyline buffer with Arcpy

I'm trying to write a python script with ArcPy that draws arcs and I've achieved something with creating a buffer and then clipping it with a bounding box so I only keep the length I need (I thought ...
10
votes
1answer
3k views

Python Script to Create Table Using Data Driven Pages

I am trying to convert some python script to display a table (based on a dbf) of features located within a specific data driven page. So far, I have the script successfully able to refresh the map to ...
2
votes
2answers
654 views

How do you use folders as input/output parameters

What I want to do is to go into a folder, find a layer file, pull it into an MXD, then export a jpeg in an output folder. Everything is great except I don't know how to set the input/output folders. ...
3
votes
1answer
975 views

How can I create an empty feature class in a file geodatabase based on the schema of an SDE feature class?

I have 150+ feature classes in SDE for which I need to create an empty feature class in a file geodatabase. For these feature classes I need to import the attributes and the name of the feature class ...
4
votes
1answer
1k views

how to turn on labels of a layer file with arcpy

I am unable to turn on the labels with the python script. I am not sure why! Please do not direct me to another post as i have read them all. This is the most recent one i've tried, with obvious ...
5
votes
3answers
1k views

Using arcpy what is the most efficient way of projecting a selection from a large data set?

I have a large data set X(x1-xn) from which I must select consecutively the attributes A(a1-an) from X.fieldsSRC or X.fieldDST and project the selections. I have a functioning arcpy script that does ...
2
votes
1answer
663 views

write multiple statistics analysis into the same output file with arcpy

How can I add multiple stats from the arcpy.Statistics_analysis to a single output file. Can I create a text file instead of a table ? Using one of the examples in help.arcgis, if I add other stat ...
3
votes
1answer
832 views

Select Layer by Location Produces Empty Output in Python

I am new to using Python scripts to execute ArcGIS tools. In my first script I am attempting to loop through many Select Layer by Location operations on overlapping feature classes. I want to create a ...
1
vote
1answer
226 views

ArcPy: Creating weekly-sum layers by summing field values from seven consecutive daily .dbf's

So I have 490 consecutive daily rainfall shapefiles/.dbf files in a single directory. Each consists of a uniform even-spaced grid of 220 points having uniform pointIDs, number of records, field names ...
12
votes
1answer
1k views

How to get size of file geodatabase feature class on disk?

Is there a simple way to determine the amount of hard drive space a feature class takes up? I feel like I'm missing something simple, but I don't recall a method that does so. You would think that ...
1
vote
1answer
1k views

Delete SDE feature class features with ArcPy

I'm working on a script that will empty my SDE database of all data. How would I go about deleting features from feature classes using ArcPy? I have an SDE connection created with a user that should ...
2
votes
2answers
601 views

Zoom to Selected feature, without using 'current' in python

I am wondering if it is possible to build a zoom to geoprocessing service without using 'current' for the mxd variable in pyhton. Using 'current' my tool works in arcmap, but not in my gp service. ...
1
vote
2answers
359 views

ArcGIS Server GP Service: How to create a txt file or rename a dbf to txt in the “%SCRATCHWORKSPACE%”

My end goal is to get an excel (I'll probably just settle for .csv) file loaded from a silverlight app into my "%SCRATCHWORKSPACE%" for my gp service. I will be linear referencing the data onto a ...
5
votes
1answer
704 views

Stop an arcgis model until all values are collected and then continue

This is similar to Modelbuilder - If precondition is false, continue iterating next input but I want the iterate tool to run to collect all the values and only then continue to the merge. Any ideas? ...
1
vote
1answer
91 views

Other than the methods stated on the Desktop 10 Sharing Tools section, are there any other ways to distribute custom toolscripts?

Essentially I want to be able to distribute a custom script and it seems that I cannot create a .tbx file, so I looked into the other methods, but they are all only for Python modules it seems. What I ...
4
votes
2answers
1k views

Dynamically change zoom level of overview map to fit with current extent in DDP

I am using DDP pages in a large mapset with pages ranging from 1:7500 to 1:130,000 and the overview map is zoomed out to far to see some of the smaller zones. Is it possible to set the overview map to ...
2
votes
1answer
263 views

Altering graticule intervals logically in varying map scales using ArcPy and/or Data Driven Pages?

This question appears on many sites and I was wondering if there was a script that is now available that resolves it? Please also upvote the ArcGIS Idea that Reference grids/graticules should be ...
1
vote
1answer
456 views

Generate MXD layer info report

I'd like to generate a report about MXD layers for a handful of MXDs. I want the report to display their name, workspace path and scale range settings. I can get the first two with ArcPy but I didn't ...
3
votes
3answers
4k views

Add feature layer to display with in a script tool for desktop mapping 'App'

The point of this question is to find a way to programatically change the map extent based on user input. My method involves creating a Feature Layer & Selection, but if you have another ...
1
vote
1answer
234 views

Small issue with field calculator

What am I doing wrong in this field calculator logic? Pre-logic def re_score(elev_t,f2, contour): f2=contour if elev_t.endswith('.5'): f2 = "Midi" return f2 Expression for field "Contourtyp" ...
3
votes
2answers
1k views

Python and Data driven pages - Advanced use

I need to make a number of maps where only one input changes (a layer with the range of a radio tower) and I want to add the layer, apply symbology, zoom to it, change the title to include the name of ...
1
vote
2answers
812 views

arcpy.Delete_management not deleting

I'm struggling with deleting an mxd in a for loop. My code is: import arcpy, glob, os, datetime, time from time import strftime for filename3 in glob.glob(os.path.join(folderPath, ...
1
vote
1answer
211 views

Index out of range error when cleaning up variables

I'm running a script that parses points from a flat database structure into individual feature classes with related tables. A search cursor runs through and stores each field's data in a variable ...
4
votes
3answers
883 views

Using threading module with Arcpy: Manager/Worker architecture

I asked this question on Stack Overflow on how to setup a manager/worker scenario. But I am getting some error when trying to use threading on my Python install with ArcGIS 10 (just the python ...
3
votes
1answer
2k views

error on mxd.save/saveACopy

I'm trying to use arcpy to save an .mxd and am having an issue. It doesn't matter if I use mxd.save or mxd.saveACopy I get the same error. I know it doesn't look like I am doing anything w/ it here, ...
4
votes
1answer
917 views

Script tool Value ERROR 000735: Output Layer: Value is required?

I've been struggling to get my script tool to run without receiving the following error: <class 'arcgisscripting.ExecuteError'>: Failed to execute. Parameters are not valid. ERROR 000735: ...
1
vote
1answer
498 views

Creating bulk field aliases for several layers within same ArcSDE feature class using ArcPy? [duplicate]

I have an ArcMap with ~200 layers from the same sde feature class. After I finished adding all the layers it was brought to my attention that we need to add field alaises for the attribute table. ...
2
votes
1answer
316 views

Use arcpy.SearchCursor with raster

How can I efficiently subdivide one raster into multiple rasters using the arcpy.SearchCursor? For example if I have a slope and I was to subdivide into 3 rasters: slope1 with values between 0 and ...
8
votes
2answers
2k views

How to Rotate Features in ArcGIS for Desktop using ArcPy?

I have a series of polygons that I want to rotate. Each polygon has a rotate angle and an anchor point (xy coordinate) stored as field values. As it happens, all anchor points are on a vertex of ...
4
votes
1answer
1k views

Sorting a table on multiple fields using ArcPy

I'm trying to sort a table based on three fields with ArcPy (which should be only one line of code), and I had a "tool is not license" error. I just saw that sorting with multiple fields as parameters ...
4
votes
1answer
613 views

Iterative position within Field Calculator/Python

I'm not great with Python or programming in general, so I'm not even sure how to ask this question. Basically what I've got is in the left column, and what I want is in the right column. UniqueID ...