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

learn more… | top users | synonyms (1)

6
votes
4answers
1k views

Raster to Polygon Scripting Problems

I am trying to make a script which selects every .png file in a folder beginning with the letters "LG". I then want the scipt create a shapefile, replacing the "LG" with "SH", and then i want the ...
6
votes
2answers
5k views

How does one access a featurelayer in SDE via Python?

I am trying to use Arcpy to run the CopyFeatures_management script so that I can copy a featurelayer in SDE. What do I use for the input (and output, for that matter, since I'll be copying the layer ...
6
votes
3answers
2k views

How can I select vector features that overlay raster in arcpy?

I have two datasets: point feature class and raster (stored in file geodatabase). The spatial extent of the raster is smaller than the point dataset. Is there a way I could select (or create new, ...
6
votes
2answers
1k views

Creating geodatabase from CSV using python

I have a file with weather data (daily) for multiple weather stations for multiple years. I am looking for some python script to automate the database creation process and its interpolation on a daily ...
6
votes
2answers
255 views

Python scripting- compute statistics

I'm new to Python but I've heard is a good way to automate tasks. I have thousands of point shapefiles and need to extract the maximum value of each one and put them in a new table. I'll appreciate ...
6
votes
3answers
1k views

Why is an extra field necessary when creating point shapefile from csv files in Python?

I have a Python script that creates a point shapefile from a csv file within a Python script. This script gives me a ValueError for the longitude field (LON) if there isn't an extra nonsensical field ...
6
votes
2answers
2k views

Is it possible to access ArcGIS's table operations “Summarize…” and “Statistics…” in python?

ArcGIS has a few nifty table tools, including Summarize and Statistics. Is there a way to access them through arcpy, or will I have to hack my own methods via math and lists?
6
votes
4answers
738 views

How to optimise and speed up Python code? [closed]

Again my lines of surface runoff... I made a script, solving the issue when lines cross other lines. Something like generalization. Like on the picture below. The problem is that I have to solve 30 ...
6
votes
5answers
191 views

How to access adjacent rows with cursor?

In the attached screenshot, the attributes contain two field of interest "a" and "b". I want to write a script to access the adjacent rows in order to make some calculations. To access a single row, ...
6
votes
2answers
502 views

How to create an oriented buffer using arcpy?

I would like to create an oriented buffer for every polygon in my shapefile using arcpy. By oriented I mean that I have two angles a1 and a2 that constraint the direction of the buffer. This is ...
6
votes
1answer
451 views

Are there any distinct advantages of creating a Python Toolbox over a Custom Toolbox?

I enjoy making different geoprocessing tools to practice Python and to become more familiar with the arcpy modules. I've just been using a Custom Toolbox and then importing the Python script and ...
6
votes
1answer
1k views

Counting number of points in a point shapefile - ArcGIS 10.0 / arcpy

I assumed this would be an easy thing to do. I'm loading a point shapefile into a map like this: layer = arcpy.mapping.Layer(file_name) Is there a way to get the number of points in the shapefile? ...
6
votes
3answers
3k views

Insert Raster to MXD using arcpy.mapping (ArcGIS 10)

What i want to do seems simple. But again i can't even find a workaround... I have got a lot of Raster-files (ESRI-GRID) which i need to insert into a layout mxd-file and then export the map to ...
6
votes
2answers
300 views

How to replace a cyrillic symbol in an attribute table using python?

I've tried searching for an answer and I've already seen some similar themes here, but I still haven't been successful in replacing Cyrillic symbols in an attribute table, which is why I'm asking for ...
6
votes
2answers
736 views

How to refresh the ArcMap display using ArcPy?

Was trying to replicate a RePast Agent Analyst simulation using just Python and arcpy. The script was about urban expansion. The script just changes the values of a column in a shape file. ArcMap's ...
6
votes
2answers
800 views

Binding Objects to List for ArcGIS Python Script Tool Parameter?

I am working on a python based script/tool. I would like to make use of drop down lists for several of the parameters. This is very easy to do if the lists are just plain old strings. Does anyone ...
6
votes
4answers
2k views

Exploding overlapping to new non-overlapping polygons?

Given multiple polygons that overlap in multiple ways, I would like to export from these features all polygons that don't overlap with others, iteratively. The product would be a number of features ...
6
votes
3answers
2k 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 ...
6
votes
4answers
2k views

Efficient arcpy method of points in polygon

Coming from a background of Mapinfo and Manifold, I frequently find myself frustrated with the ArcGIS SQL toolset. In both these former programs it is trivial to write a query asking, for instance, ...
6
votes
3answers
3k views

Writing world file when exporting TIFF using ArcPy Mapping?

According to documentation, the options are: Syntax ExportToTIFF (map_document, out_tiff, {data_frame}, {df_export_width}, {df_export_height}, {resolution}, {world_file}, {color_mode}, ...
6
votes
2answers
2k views

Getting XY map coordinates on mouse clicks as input variables into a python script

This is my first time coding in python, so bear with me. I wrote a script to calculate an analytical solution to find the orientation of a plane based on three points. I'm using ArcGIS 10.1. # Input ...
6
votes
2answers
1k views

Getting unique value of second field using arcpy.da.SearchCursor?

I have a feature class and using arcpy.da.SearchCursor I'm getting unique values of a field (e.g. Name). How can I use this method to get the associated row value of a different field (diff field = ...
6
votes
1answer
266 views

How to call arcpy.RefreshActiveView() every 5 seconds using ArcGIS Python?

I have an Excel macro that generates random values after every 5 secs and I am reading it in ArcGIS for Desktop... to refresh the view I have to press f5 and the view gets updated. Now I want to ...
6
votes
1answer
198 views

How much database bloat is reasonable?

I use personal geodatabases to hold all the data for my projects (probably around 10-20 feature classes across 2-4 datasets on average). I use the personal gdb because I like being able to hook into ...
6
votes
1answer
398 views

Counting Files with a Spatial Reference using Python

I need to display a list of feature classes with an unknown spatial reference, and the number of feature classes with a spatial reference. I think I have the first part right, but having troubles with ...
6
votes
1answer
2k views

Is there a way to delete a raster using arcpy / ArcGIS 10.0?

I'm trying to find a way to delete a raster dataset (in any format) using arcpy. As it is now I have been writing custom functions for each file type (eg, delete directory and pyramids for grids, ...
6
votes
1answer
767 views

How to do a separate Python installation with ArcGIS?

I see a lot of threads asking how you can have a separate Python installation (e.g. the Anaconda or Python XY distribution) and get it to work with arcpy, while not 'breaking' ArcGIS at the same time. ...
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 ...
6
votes
2answers
381 views

Possible to Call ArcPy Script From AddIn in ArcGIS 10.0?

Is it possible to call an ArcPy script from a Java/.Net addin in ArcGIS 10.0?
6
votes
3answers
3k views

need to clear cache memory using python

I have looked at several posts here and on other sites but have not found a solution to the problem I am having with this python script. In this script I use 2 nested 'for' loops to extract a series ...
6
votes
1answer
193 views

Pull Data from Specific Excel Cell into ArcPy

I am new to Python and ArcPy, and wish to create a short script that pulls in a value from one specific Excel worksheet cell (namely, A2) and then performs an 'if' statement, whereby if the value of ...
6
votes
2answers
233 views

What technology is used behind arcpy cursors?

I'm using ArcGIS Server 10.0. I have a geoprocessing using arcpy search, update and insert cursors. I'd like to know more about the technology behind these cursors. Does it use any driver or pool to ...
6
votes
1answer
326 views

Why does tool take longer to run when in Python script?

I have written a python script that does some euclidean allocation. For that I use arcpy.gp.EucAllocation_sa() method. Now, my python script takes 30-40% extra time than spatial analyst euclidean ...
6
votes
1answer
1k views

Is it possible to convert graphics to features in ArcGIS 10 using arcpy?

Apologies if this is easy but I cannot seem to find the answer. Is there a way to convert a graphic to feature, i.e. use the "Convert Graphics to Feature" tool on the toolbar, within arcpy? I need to ...
6
votes
1answer
3k views

Setting Output Parameter in ArcPy for Server Tool

I have published the following script tool (which is wrapped in a model, i.e. just the script tool and all of its parameters) to ArcGIS Server 10. The GP service succeeds when run, but I cannot ...
6
votes
1answer
1k views

Get shape filename in attribute field using field calculator

I apologize for crossposting against the ESRI geoprocessing forum, but it seems like this one gets answers. I'd like to have a modified append tool (ArcToolbox) that takes multiple shapefiles with ...
6
votes
4answers
557 views

accessing the output of a python script tool dialog ArcGIS 10.1

Hi I have a a fairly simple script tool dialog which has been setup to get 6 parameters from the user and return them as the tool output as a list. the aims is that the out put would then be used ...
6
votes
1answer
176 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". ...
6
votes
3answers
1k views

Insert points into SQL Server?

I am collecting X and Y values from a web service (Twitter) via a python script. In the long run, this will run over a period of months and I intend on stopping at around the 6 million point mark. ...
6
votes
1answer
400 views

Algorithm to fill the gaps adjacent to parcels

I would like to find a way to fill the gaps between the road and its surrounding parcels, like described in picture below: I have different parcels like A and B , i want to fill the gaps by adding ...
6
votes
1answer
5k views

issues importing arcpy in Python IDLE

Hi I would want to use arcpy in my python code. I am able to import it through the ARCGIS desktop python console. But I am not able to import it into Python IDLE. I get the following error Traceback ...
6
votes
1answer
570 views

Is there anyway to make GPModels with python scripts execute faster?

I do not know if anyone else has this problem but my GPModels that include simple python scripts seem to take way too long to execute. One example is a model I built which is a simple select feature ...
6
votes
3answers
1k views

Is anyone successfully using arcpy.ExportMetadata_conversion?

I don't know if it is a bug or my lack of python skills, but I keep getting 'ERROR 000816 The tool is not valid' in my python script when I call ExportMetadata_conversion Initially, I was attempting ...
6
votes
1answer
248 views

Is it possible to interrupt Select Layer By Location when first feature selected?

I´ve got a point feature class with some 7.000.000 points and I´m trying to check if any of these points is simply intersected by several polygon feature classes using 'for' loop and ...
6
votes
1answer
395 views

ModelBuilder: How to extract data by date, export to separate tables and interpolate tables to rasters

I've been using ArcGIS for a couple years, but when it comes to model builder I've only worked with very simple models. I'm hoping someone that is much smarter than myself can help me in building a ...
6
votes
3answers
226 views

Are there any open source Python modules compatible with arcpy that will allow complex SQL queries?

I am trying to handle string (non-geometry) duplicates in a large attribute table of a shapefile without having to convert to gdb and back or connect to a postgres db. I need to be able to use a count ...
6
votes
3answers
876 views

Arcpy's replaceDataSource Error

I've checked the other answers here and none of the answers worked for me... It's a "simple" matter of finding a layer by name in a map and changing it's datasource. Here's my script: #-- New ...
6
votes
1answer
656 views

Why are results from Python tool not in Results window?

I am relatively new to ArcPy 10. and I want to return the list of feature class from a dataset. I can see them through the message, but cannot see them from the result window. Actually there are only ...
6
votes
4answers
2k views

How to interpolate points along a line in Python for ArcGIS 9.3?

I am building a Python geoprocessing script for ArcGIS 9.3. In the script, I have a simple LINE feature class with one row, one line. How can I use a linear referencing system to interpolate a point ...
6
votes
1answer
711 views

With arcpy, how do I detect relationship classes in a file GDB (or can't I)?

I would like to be able to detect relationship classes in a file GDB. Because users of my script might have only an ArcView level license, they would not be able to manipulate the schema of a feature ...