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

learn more… | top users | synonyms (1)

4
votes
3answers
386 views

Checking if python script is run from ArcGIS (arcmap or on server) or a stand alone python script

For debugging purposes I have created a hardcoded conditional that checks it the script is run as stand alone or as an ArcGIS tool. Is there anyway to fugure this out at run time? e.g. some ...
4
votes
2answers
401 views

Does ArcPy leak memory when importing CSV files?

I'm trying to import a great number of csv files of about 250MB each. I wrote a python script for that as follows: import gc import glob tables = ...
4
votes
5answers
677 views

Python loop Polygon to raster not working

I want to convert a large number of different shp polygons to raster in ArcGIS 10.1, using an existing field column "class" for the new raster classes. I am not very fluent in python but I thought ...
4
votes
3answers
889 views

How integrated can an IDE get for arcpy scripting?

I am looking to develop arcpy scripts (ArcGIS 10.1) in an IDE that is more "integrated" than Pythonwin. I would like an experience that is analagous to programming ArcObjects in Visual Studio ...
4
votes
2answers
842 views

Trouble finding YMin and YMax of a shapefile in ArcMap 10 and Arcpy

I want a python script that tells me the Xmin, Xmax, Ymin, and Ymax of a polygon. (I guess this is finding the extent of a polygon?) My current script gives me the correct the Xmin and Xmax, but it ...
4
votes
3answers
2k views

Why would “import arcpy” hang Python script run from DOS/cmd prompt?

I have a very small test script (test.py) that I use to see if Python is installed and ready to use ArcPy. All it contains is: print "Starting" import os print "OS imported" import arcpy print "ArcPy ...
4
votes
2answers
116 views

Using Spatial References with ArcPy after *.prj files no longer installed by ArcGIS 10.1 for Desktop?

I'm writing a python script that uses the CreateFeatureclass_management tool, without a template. One of the required parameters is a spatial reference. I used to be able to point to the system *.prj ...
4
votes
1answer
2k views

How to Export Selected Feature to New Shapefile Using ArcPy?

I currently have a search cursor iterating through a shapefile in ArcGIS 10.1 that selects a feature and runs a viewshed analysis on that feature (and only that feature). What's the easiest way to ...
4
votes
1answer
260 views

Switching between background 64 bit processing and 32 (so I can use 3rd party ie XTools)

I often run scripts now with 64 bit background processing enabled but when I want to use certain tools like Xtools table to text I have to turn it off as these tools are 32 bit. Is there a way to ...
4
votes
2answers
288 views

How to pass an output stored in a single variable into another script using arcpy

I am running set of processes each with different outputs in a python script. Is there a way to set a variable as global so that just the output of that single step can be accessed from other scripts? ...
4
votes
2answers
2k views

Create temporary files as intermediate output to be used as input in concatenation

Q_PART_I I need to merge many (MANY) tables in one unique output table by means of the arcpy.Merge_management. Anyway, I'd like to avoid the creation of tons of intermediate files as my script ...
4
votes
2answers
4k views

Remove lock on feature class

When i try to delete a feature class , after or during the use of an Arcgis engine app which uses the same feature class i got an error concerning the lock , so i can't get ride of this lock until i ...
4
votes
4answers
2k views

Export list of Feature classes to CSV

I am successfully using the follow script import arcpy from arcpy import env import os env.workspace = ("WORKSPACE") fcList = arcpy.ListFeatureClasses() print fcList to export feature class names ...
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 ...
4
votes
5answers
323 views

Dissolving polygons fails on computers with small amount of RAM

When I'm trying to dissolve a polygon through an arcpy script the operation fails with the 999999 error on computers with small amount of RAM [~3 GB] (known issue). Unfortunately neither this, that ...
4
votes
1answer
295 views

call Sql Server stored procedure form arcpy

Is there a way to execute a SQL Server stored procedure with arcpy or Python and retrieve the results returned by the stored procedure? There is a very similar question posted on ArcGIS forum with ...
4
votes
1answer
150 views

Where can I find ArcGIS logs when I execute a python script using arcpy?

I'm executing a python script locally on my computer where ArcGIS Desktop 10.0 is installed (Windows 7). The script uses functions from the arcpy library installed with the ArcGIS Desktop to manage ...
4
votes
1answer
61 views

Programatically detect the format/version of an arc toolbox (e.g. 10.0,10.1 etc)

Is there a way to tell programatically (from the command line) what format a given ArcMap toolbox was saved in - 10.0, 10.1 and so on?
4
votes
1answer
453 views

arcpy “The table name is invalid”

I wrote a script that, ideally, loads raw .las (LiDAR data) files into a geodatabase, then creates a terrain from the multipoint files that are created. When I run the script though I get: ...
4
votes
1answer
91 views

How to return text from GP service?

So I've got a website that I want to extend by letting people look up postal/zip codes for an address they enter. I've already got all the addresses (with their postal codes) for the city in an ...
4
votes
2answers
352 views

Python Script to convert a mass of KMLs to a single fGDB

I have a mass of KML files, approx 350+ that I need in a single fGDB. I lifted a string of code from ESRI help to attempt to do this - I got it working to the point of creating all the individual ...
4
votes
1answer
375 views

Has anybody used arcpy.mapping.ExportReport successfully on 64bit machine?

The online help for arcpy.mapping.ExportReport says that it has some restrictions on use but does not list 64bit machines amongst them. I am running the following test from IDLE under ArcGIS 10.1 SP1 ...
4
votes
4answers
190 views

How to determine if all points on a map are identical in arcpy?

My eventual goal is to automate kernel density calculations for a large corpus of point data; however, if all points are identical (for example, if there are 7 points all stacked on top of one another ...
4
votes
3answers
385 views

Bulk convert DBF to CSV in a folder ArcGIS 10.1 using Python

I would like to convert 1000 dbf files to CSV. All dbf files are in one folder and they have sequential names (S:\output_tables\tcb1.dbf, S:\output_tables\tcb2.dbf, S:\output_tables\tcb3.dbf, up to ...
4
votes
1answer
456 views

What is Python equivalent of ModelBuilder's Iterate Feature Selection?

My data consists of two featureclasses: Points = points representing trees Polygons = Polygons representing % canopy area by area. Each polygon in the FC has a % canopy measurement in the ...
4
votes
2answers
180 views

How to get XY coordinates and field values for each row in a SearchCursor?

I am trying to enumerate each row of a points shape file and get a certain field's value (elevation) and the xy coordinates. But I see I can only use: arcpy.SearchCursor to get the field; OR ...
4
votes
1answer
229 views

How to check if feature class or table contains field with specific name before adding it?

Im trying to write a script that finds out if the shapefile has a specific field and if not to add the field. I get it to show me the field, but the loop goes through each field, so it would create a ...
4
votes
2answers
347 views

Automating a Python expression to calculate acres

I'm not new to GIS but very, very new to using Python and using scripts. I successfully use a Python expression !shape.area@acres! to update a field with acres in a feature class. What my users ...
4
votes
1answer
598 views

Select by attribute expression invalid in python

I'm not sure how my expression is failing. Any ideas? inPoints = "points.shp" i = 0 arcpy.MakeFeatureLayer_management(inPoints, "pts") arcpy.SelectLayerByAttribute_management("pts", "NEW_SELECTION", ...
4
votes
1answer
104 views

Arcpy error message: 'Layer' object is not subscriptable?

What the code does successfully so far, is gets a list of the layers in the first data frame of the current map. What it doesn't succeed in doing is, joining the layer names to the gdb location using ...
4
votes
2answers
800 views

arcpy.da.SearchCursor - unique value get second field value

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 = ...
4
votes
1answer
139 views

How to stack rasters for ecological analysis?

The attached image shows two different forest openings. Each opening has the following layers associated with it: Point shapefile 1 = A red X which represent a large "legacy" tree in the gap Point ...
4
votes
1answer
851 views

How to List field name aliases in ONE shapefile/layer using ArcPy?

I want to use arcpy/python to print out a list of all the field name aliases for a specified shapefile. So far I have been able to hack a script I found to list all the field name aliases associated ...
4
votes
1answer
2k views

How to find and delete identical points?

I recently performed Integrate on a merged point feature class in ArcGIS 10.1. I specified "1 meter" XY tolerance for the Integrate command. The resulting point feature appears to be what I want ...
4
votes
2answers
2k views

Clipping raster by multiple datasets or polygons?

I would like to clip a DEM using a grid of polygons. It's probably easier to use multiple polygons in one shape file, but I haven't managed this so I'm trying to use a for loop so I can loop through ...
4
votes
2answers
685 views

Arcpy remove invalid character

I've built a model that takes the name of the Excel worksheet containing xy data, and uses that name as the name of the output shapefile. ( Worksheet "massachusetts_sightings" in an xlsx becomes ...
4
votes
2answers
986 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
2answers
795 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 ...
4
votes
1answer
243 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.
4
votes
2answers
849 views

Resequencing Legend Items in Python

I create various layers programmically with Python in ArcMap 10. I can adjust how the layers are sequenced using the arcpy.mapping.MoveLayer command. But I want to have the legend reflect a different ...
4
votes
1answer
76 views

Most efficient method to join multiple fields in ArcGIS

I have as set of shapefiles with approximately 300000 polygons each, as well as corresponding point shapefiles and tables with approximately the same number of row (equal or less rows than the ...
4
votes
2answers
162 views

How to transfer attributes to thousands of local points from ArcSDE feature class with millions of polygons?

I have a set of points and a huge feature class with topographic information (OS MasterMap for who knows it). I'm talking millions of polygons huge. I want to transfer attributes of the polygons to ...
4
votes
1answer
121 views

Is it possible to store a default symbology layer in an arcpy add-in?

Since arcpy is limited in how symbology can be manipulated, I was curious to know if a symbology layer can be stored in an arcpy add-in. Does anyone know if it is possible to store a .lyr file, or ...
4
votes
1answer
84 views

Convert linear polygons to lines

Hi I have some long linear polygons that I'd rather store as lines but I'm not sure how best to do this. Ideally I'd have a line goiung through the centre of the polygon lenthways. I have two ideas of ...
4
votes
2answers
379 views

Focal statistics to calculate saddle points from DEM

I have a conundrum with Focal Statistics and kernel files. I am been trying to identify saddle points in DEMs. I am attempting to rewrite this (thanks whuber) in a python script for 10.1. I have ...
4
votes
1answer
608 views

Why can't I multiply two string fields in the Field Calculator by converting them to int() and float()

I'm using ArcGIS 10 and new at python scripting. I have a string field that I need to calculate by multiplying two other string fields. I can do it in python using two arbitrary values... CINPT1 = ...
4
votes
3answers
2k 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() ...
4
votes
1answer
887 views

How do you add a long list of rasters together in Python?

If you have produced a long list of rasters (lets say 50) and want to add them together, is there any shorter way to write in python rather than typing all the inputs, like so: outRas = inRas1 + ...
4
votes
2answers
862 views

Python script to implement a batch import of CAD files into Geodatabase

Please does anyone know where I can get a python script that can do a batch import of CAD files into a Geodatabase. I have one I wrote here, but it is only able to import one CAD file at a time. It ...
4
votes
1answer
799 views

ArcPy performance issues with an UpdateCursor when sorting

I'm hoping that someone will be able to help me here. I have written a short ArcGIS Python script (mainly cobbled together from other examples) that sorts a feature class ascending based on two fields ...