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

learn more… | top users | synonyms (1)

5
votes
4answers
6k views

How to use Arcpy UpdateCursor to update a field?

This should be simple but I've spent days trying everything to get it to work. I need to update a field in a layer based on two other fields. I can't even get it to update based on one field. Could ...
5
votes
2answers
2k views

How do I calculate a weighted centroid with respect to a raster, e.g. population weighted centroid

In ArcGIS 10.0, how do I calculate the weighted centroid of a collection of polygons, where I want the weight to be a raster layer. In particular I am using a raster of population counts and would ...
5
votes
2answers
1k views

How to get sum of table column values into Python variable?

Im creating a script to calculate some new fields in Arcgis10.1 using the arcpy library. I need to sum the total of a table column in order to calculate a new field. I wanted to ask if it is possible ...
5
votes
1answer
1k views

How to Make a New Shapefile Based on Attributes of an Existing Shapefile?

In my last post I had an issue where I wanted to create multiple shapefiles based on only one attribute field (years). How to do it was answered in that post. I want to make that tool more dynamic so ...
5
votes
1answer
351 views

Good practices for storing connection info while deploying geoprocessing tool on Server

I have a geoprocessing tool written in python. It will be deployed on ArcGIS for Server 10.1 as a GeoProcessing Service and it's processing workflow includes some manipulations with data in SDE ...
5
votes
2answers
648 views

Problem with the where clause in ArcGIS when dealing with variables

I am writing a python script for ArcGIS. I have an input feature class which contains multiple pipelines which is saved as a variable InputPipeline. I would like to iterate through the pipelines and ...
5
votes
3answers
3k views

How to create lines from points pair coordinates with arcpy?

I've got some points pair coordinates (start and end points) which I have to transform into lines. Until now, I used an append of both the coordinates in a pippo.Point(), a pippo.CalculateGeometry() ...
5
votes
2answers
857 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 ...
5
votes
2answers
712 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 ...
5
votes
2answers
2k views

Using SearchCursor to access & export values in a raster table

I am desperately trying to export the values in a raster table to a .txt file. I've seen some other folk post about this, but for some reason can't get the code to work in my case. I have a raster, ...
5
votes
1answer
3k views

Arcpy cursors, WHERE clauses, and date/time fields

I'm having trouble making a selection of rows that meet certain date criteria using my arcpy.UpdateCursor(). I need to update records in a field in a geodatabase table with an ascending value based on ...
5
votes
1answer
2k views

Create a definition query for groups of layers: Is it possible?

I have a large number of groups created, with each group having many layers. I have looked for a way to set a definition query for all the layers in each group but haven't found anything. Is it even ...
5
votes
2answers
157 views

What are the alternatives to ArcMap's Report Wizard?

I have a polygon layer which has lots of attributes, and I'd like to create a report template which summarises these attributes for individual polygons. That is, the user will select a polygon from ...
5
votes
1answer
212 views

Arcpy Pythonaddins Equivalent of arcpy.GetParameterAsText

I've build a neat little search arcpy script. The user opens any mxd, zooms to a location, chooses a corporate fGDB, and runs the tool. The user gets a list of all the populated feature class that ...
5
votes
1answer
263 views

data driven pages format

I have an issue, but I don't even know the terms needed to search for an answer. I'm exporting the pages to png files. The pages are divided by lots. Each page has a label with the lot number. In ...
5
votes
2answers
545 views

How to create Network Dataset for Network Assistant using ArcPy?

Is it possible to create a network dataset with ArcPy to be used with the network assistant? In the documentation I found the Build Network and Dissolve Network functions, but it looks like both ...
5
votes
5answers
869 views

How to add Radio Buttons to Python Script tool dialog?

I have 3 Point shapefiles for 3 species that contains the accession points of each. The user needs to specify only one species at a time. I need to write a script tool for adding the selected Point ...
5
votes
1answer
597 views

problem with “Con” conditional expression

I created a python script where I use Con (Spatial Analyst). Till now I passed the where clause value as value>1000 and it worked fine for me. But recently I found some raster on which Con ...
5
votes
2answers
3k views

How to clip/export multiple selected vector layers in a map to extent of another raster/vector layer in ArcGIS?

Is there a way to clip/export selected vector layers (more than one) in a map to the extent of another raster/vector layer at a time?? in Arcgis or any other software. I am using Arcgis10. I am ...
5
votes
3answers
525 views

How not to Copy Features when too many would be output?

This question has already been posed to the ArcGIS Geoprocessing forum but I have had no responses there. I have a 3.5 million polygon layer (cadastre) stored in Oracle via ArcSDE. I use a polygon ...
5
votes
3answers
4k views

Select Layer By Attribute using loop

I have 273 features in the feature class and i want to select them one by one and use the statement in the following code. At the line: *arcpy.SelectLayerByAttribute_management ...
5
votes
1answer
756 views

arcpy.mapping.ListLayoutElements() takes longer in a tool than in ArcMap

Has anyone else noticed that accessing elements from arcpy.mapping.ListLayoutElements() through a tool script takes longer than within ArcMap? Whether using a specific name, wildcard or nothing, the ...
5
votes
2answers
2k views

(New at Python Scripting) Creating a Loop so i can replace text in page layout in multiple mxds instead of one mxd at a time

I found some code on a website that will perform a search and replace on page layout text elements. Currently you can only do it one MXD at a time. I was hoping to change the code so I can do a search ...
5
votes
2answers
207 views

Creating numpy.array with variable number of fields to test arcpy.da.ExtendTable performance?

There was an ArcPy Café blog posting entitled Adding Fields: Performance Tips which advocated: Two approaches to help increase performance when adding numerous fields to a table or feature ...
5
votes
2answers
1k views

How to replace arcpy.CalculateField_management with an update cursor?

I'd like to replace this expression arcpy.CalculateField_management(bufferFile, "Shape_Area", "float('!shape.area@squaremeters!')", "PYTHON") with an arcpy.da.updatecursor. The reason for this is ...
5
votes
2answers
261 views

Error 000725 message from output workspace when using Python (ArcPy) script tool?

I am having trouble running a script tool that I just created in Arc 10.1. The script runs fine in PythonWin, but when I create a script tool with it, the tool seems to not want to accept folders or ...
5
votes
1answer
276 views

What is the most efficient way to get a list of featureclasses from a large ArcSDE database?

I have a SDE DB which consists of 40 feature datasets and around 300 featureclasses. I need to get the full list of all featureclasses whose name does not contain "ARCHIVE". It takes several minutes ...
5
votes
3answers
600 views

Convert polyline with Left ID and Right ID to polygons with ID

I have a polyline shape file which contain Left Id and Right ID information and struggling in converting this polyline layer to polygon with ID via arcpy. I am using ArcGIS(editor) license so feature ...
5
votes
1answer
47 views

PySAL natural breaks from Numpy array

I am attempting to extract natural break values from a raster using Python. The intended process goes: Arcpy raster object to NumPy Array (using RasterToNumPyArray) to natural break values (using ...
5
votes
1answer
107 views

Calculate the common area between polygons using python?

I am trying to calculate the common "empty" area between the neighbouring polygons in order to calculate the porosity volume (the red area in the image) My idea was, first to use Convert ...
5
votes
1answer
109 views

Is it possible to drive one mxd (pan) using a different mxd with python?

I have 2 mxd's. mxdA and mxdB They both show different data, but are both in the same coordinate system. I want to be able to sync mxdB with mxdA, so that if I pan / zoom in mxdA, I can then, with ...
5
votes
1answer
266 views

How to get the editor's current layer in ArcPy?

In ArcObjects, it is possible to retrieve the currently selected editable layer using IEditor3.CurrentTemplate.Layer, or IEditLayers.CurrentLayer. Is it possible to do the same thing in ArcPy? In ...
5
votes
1answer
538 views

How to automatically generate useful scales for data driven pages in ArcGIS desktop

I have been tasked with creating several hundred maps of properties that intersect a long pipeline. The maps will zoom to the part of the property which shows the intersection. The lengths of ...
5
votes
2answers
194 views

How to check if Waste-Water Manhole connect to lines with the right flow direction?

I have a waste-water geometric network with flow direction throw digitize direction. I want to check if each manhole have a line flowing in and a line flowing out. Is there an attribute of line vertex ...
5
votes
2answers
1k views

How to copy an SDE geodatabase to a file geodatabase using Python?

I would like to make an exact copy (domains, feature datasets, feature classes, etc.) of an SDE database to a file geodatabase. I have tried several possibilities, including: using the Copy (Data ...
5
votes
1answer
595 views

How to arcpy.Describe() a layer when script is run from outside of ArcMap?

The following code will work if I run it from the ArcMap Python dialog, or from a GP tool, but not from PyScripter IDE: import arcpy mxd = ...
5
votes
1answer
176 views

Why do ECWs go missing when exporting MXD to PDF with ArcPy?

I'm trying to export some MXD maps to PDF with arcpy (ArcGIS 10.1). Everything works fine and dandy except for ECW images, which don't appear in the PDF. However, when I execute the same code from the ...
5
votes
2answers
357 views

SelectLayerByLocation not Selecting

I have been trying for some time now to create a script to extract the polygons within an extent, but am unable to get the same result as when I use the user interface manual method. Maybe someone ...
5
votes
3answers
2k views

Table to table script using Excel sheets (not workbooks) arcpy

So what I'm trying to do is to create feature classes from the sheets in an Excel table. I can get it to work if I save each excel sheet as its own workbook, however this isn't really what I want. I ...
5
votes
3answers
286 views

What's the centerline of a peninsula?

Given a peninsula stretching north south and the two coast lines connecting in the south, I want to find out which is the place, or rather line, which is furthest away from both coastlines on the ...
5
votes
1answer
1k views

How to update shapefile data source in multiple dataframes and mxds using lyr.replaceDataSource and Python dictionary?

After reorganizing the file structure for some of our GIS base data files I need a script to update the data sources for ~ 100 shapefiles in about 50 mxd files. Some of the mxds have multiple data ...
5
votes
2answers
900 views

How to improve Python script processing speed (performance)?

I've been working on a script which essentially reads in a large amount of point and polygon data and generates frequency values for a featureclass of 2.5 acre hexes covering California. I have found ...
5
votes
1answer
2k views

Exporting map to jpg (multiple times with python)?

I set symbology and exported each raster in my mxd (one by one) to jpg file. My script is ok and it works (it is shown at the bottom). The question is: how can I customly set my legend? Now I have ...
5
votes
2answers
940 views

Permanently replace/update server/service in each ArcSDE Layer in MXD?

Using the mxd.findAndReplaceWorkspacePaths method, if and MXD is updated and the path the the .sde connection file moves again all of the data sources will break again. Is there a method to ...
5
votes
3answers
1k views

How to repair paths of an unmanaged raster catalog in file GDB?

I'm using ArcGIS 9.3.1 and I have an unmanaged file geodatabase with raster catalogs in it. Tiles are loaded inside the catalog and each tile has a "Full Path" property which is environment specific. ...
5
votes
1answer
592 views

Is there a way to get layers from a .msd using arcpy?

I need the name of each layer in an .msd, but I could not find support using arcpy (ArcGIS 10.0). Is there a method I missed? In the current workflow, since I am publishing the document, I use the ...
5
votes
2answers
398 views

ArcMap Draw Camera Range with ArcPy

i am working on some camera data. I have some points which consist of azimuth, angle, distance, and of course coordinate field attributes. In arcmap I want to draw shapes like this: The shape is ...
5
votes
2answers
2k views

Efficiency of python script using SAGA and arcpy

=== SUMMARY === I have created a process to import a LAS point cloud, clip it, select the ground points and save the output as an XYZ.txt for clients to use. This uses a python based script (will ...
5
votes
2answers
2k views

Installing ArcGIS 10 with Python(x,y)

EDIT 10/20/2011: The problem I was having below was caused by trying to install Python(x,y) after ArcGIS 10. I got a new machine yesterday and instructed IT to install Python(x,y) 2.6.5.3 (has ...
5
votes
2answers
2k views

Cannot get rid of lock on file geodatabase and feature class created in Python script

I have a python script, (for ArcGIS 10), that creates a new file geodatabase, creates a new feature class in that file geodatabase and then reads data from an SDE feature class to populate the new ...