A python API created by ESRI to perform geoprocessing and layer management.
5
votes
4answers
999 views
Creating perpendicular snapped polylines between an existing point and polyline using arcpy
Here's my situation - I'm working on a project that requires 20,000+ short connector lines be created, each drawn from a point to a snapped location on a nearby polyline such that the resulting ...
5
votes
1answer
550 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
4answers
3k views
'Import arcpy' error (RuntimeError: NotInitialized) when using IDLE
ArcGIS Version: ArcGIS 10, Python 2.6.5
Machine: Windows 7 64bit (Intel)
I'm receiving the following error when importing arcpy using the the IDLE (gui and cmd prompt) and when using pythonwin.
I ...
5
votes
2answers
1k 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
1answer
155 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
1answer
2k 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 ...
5
votes
3answers
376 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
2answers
138 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
2answers
424 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
3answers
679 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
134 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
509 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
1answer
176 views
Is it possible to install ArcPy on a server for use in a geoprocessing web application?
I have a website on my intranet and would like to add some geoprocessing tools to it with Python.
Many Users will not have Arc installed on their machines, so I think I need to have the scripts set ...
5
votes
1answer
420 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
274 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
966 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
1k 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 ...
5
votes
1answer
141 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 ...
5
votes
1answer
266 views
ArcPy script causing python.exe to stop working (memory issue?)
I have a script written in Python that uses ArcPy to create maps of the kernel densities of thousands of datasets. Each dataset is relatively small, but there about 50,000 sets in total.
When I run ...
5
votes
1answer
105 views
Why Can't ArcPy Search the Newly Created Feature
I'm running the following tool in ArcGIS 10. I have an ArcPy Script like this:
import arcpy
from arcpy import env
env.workspace=r"C:/sde/lcimrl.sde"
fc="SDE.ATTACHMENTS\SDE.attachment_points"
fcRows ...
5
votes
1answer
62 views
Is there an arcpy equivalent to IPixelBlock in ArcObjects?
Trying to figure out a way of doing this via arcpy, but don't see anything remotely related to this. My raster dataset is a GRID.
'pPixBlock is an IPixelBlock
'sets raster to be one column ...
5
votes
1answer
159 views
Adding kernel density output to map with ArcPy
I am trying to emulate the behavior of the Kernel Density tool from the ArcMap 10 GUI in a script; in other words, I want to calculate the density of a dataset, and add the visual result to a map. If ...
5
votes
2answers
106 views
Is there a way to increase the search radius of nearest neighbors for the Nibble tool?
I am working with a raster map vegetation types. I have about 20 types with unique raster code values that can be sorted into three classes:
1 - vegetation types I want to expand using the nibble ...
5
votes
3answers
678 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 ...
5
votes
1answer
481 views
Get shortest distance between two geometries in ArcPy
I'm using ArcPy and using a cursor to step through one polygon feature class. For each of these 'source' polygons, I am creating a SearchCursor to find all polygons in a second feature class that ...
5
votes
3answers
618 views
What is Quickest way to Copy Single Selected Polygon from Very Large ArcSDE Feature Class?
I have selected a single polygon, which is large but not massively complex, from an ArcSDE 9.3 for Oracle feature class with 3.5 million polygons using ArcGIS Desktop 10.0 SP3.
I would simply like ...
5
votes
2answers
258 views
How to setup pycharm to reference arcpy
How would I setup pycharm to recognize import arcpy? I'd like to use pycharm to develop and debug geoprocessing tool.
Thanks,
Vu
5
votes
1answer
177 views
Changes in synchronized replica not shown in ArcMap or ArcCatalog without refreshing
I am synchronizing a one-way replica in ArcEditor using Python. I tried adding RefreshActiveView and RefreshCatalog to the code, but I still need to refresh the synchronized database to see the ...
5
votes
1answer
537 views
Script tool Value error
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: ...
4
votes
3answers
2k views
arcpy.MakeFeatureLayer in-memory layer still exists when subsequent step fails during testing
When I used arcgisscripting to create in-memory output layer with gp.makefeaturelayer, I would put it in a try/except block and delete the gp object in the except piece when the makefeaturelayer would ...
4
votes
3answers
321 views
How do I access an attribute table within a shapefile and replace values?
I would like to find a Python script that will access an attribute table within a shapefile and either update or replace records inside a field column. More specifically, I would like to use the ...
4
votes
4answers
83 views
How to rename a file in the output (ArcGIS python)?
raslist=arcpy.ListRasters()
for ras in raslist:
arcpy.ProjectRaster_management(ras,outfolder2+ras+'_Albers',spatialref2)
print ras+' has been reprojected'
I was using the above code for ...
4
votes
2answers
347 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.
>>> ...
4
votes
3answers
163 views
Is there anything faster than a cursor in ArcGIS to calculate records?
What is the most efficient (fastest) way to calculate records in a layer in ArcGIS?
Is there anything faster than the Cursor in ArcGIS?
4
votes
3answers
1k views
How do I include a variable in the 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 ...
4
votes
2answers
400 views
Python - Check for number of shapefiles in a directory
I want to test:
to see whether or not ONE AND ONLY ONE shapefile (which will be based on a filename wildcard) exists in a directory.
Add these shapefiles to a list
Use this list variable as an ...
4
votes
2answers
534 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
3answers
3k views
ArcGIS 10/arcpy: Help needed with syntax for CalculateField_management in Python script
I need to use CalculateField_management in a Python script, and the calc expression needs to concatenate a runtime variable, a string, and a field (string) value. I have searched all over for ...
4
votes
5answers
306 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
2answers
539 views
How to programmatically work with featureclasses from multiple geodatabases?
I have produced a Python script which creates multiple buffers of specific (listed) featureclasses within a geodatabase. This is achieved by running each feature through a for loop.
I would like to ...
4
votes
4answers
1k views
Automate Projection of multiple shp files using ArcPy
I have been trying to create a Python script that will convert all shape files within a folder from GCS WGS 84 to Web Mercator. Below is the code I have so far but what I'm struggling with is how to ...
4
votes
3answers
1k 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
93 views
Python - formatting path strings and checking if a path exists
I would like to use the following code to determine if a path exists. The path I would like to check is being passed to my code via parameter on a ArcMap 10.0 tool dialog box. The parameters data ...
4
votes
2answers
125 views
Arcpy memory leak
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
1answer
70 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
155 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
936 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
867 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
2answers
1k 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 ...

