Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [arcpy]

A site-package created by Esri to expose ArcGIS Desktop (ArcMap and ArcGIS Pro) geoprocessing, mapping, etc, to Python.

5
votes
3answers
3k 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 ...
3
votes
1answer
641 views

Can you access ArcScan from a python script?

I'm using a python script with ArcPy in ArcGIS 10, and want to access some ArcScan functions. Is this possible? I can't see anything in the documentation about it, but I can't really find any very ...
27
votes
6answers
24k views

Defining projections for multiple shapefiles in ArcMap?

I have over 100 shape files that don't have .prj file and thus when I bring them into ArcMap 10 they show the coordinate system as unknown. I know all of the shape files coordinate system is GCS WGS ...
13
votes
1answer
3k views

Displaying raised error messages to user in ArcGIS Geoprocessing Results window?

Can print statements raised from a custom exception be displayed in the Geoprocessing Results window? I modified a script that I found that takes two inputs from a user, finds the associated feature, ...
20
votes
2answers
30k views

Adding shapefile or feature class as layer in ArcGIS Desktop using Python/ArcPy?

I am trying to automate various tasks in ArcGIS Desktop (using ArcMap generally) with Python, and I keep needing a way to add a shapefile to the current map. (And then do stuff to it, but that's ...
5
votes
1answer
2k views

Updating point geometry based on geometry of another feature class using arcgisscripting?

I'm looking to update the point geometry of lets say "oldFC" by obtaining the shape geometry of "newFC" and applying that to the "oldFC". I also want it to grab the value in the ID field in "newFC"...
21
votes
3answers
7k views

Adding new group layer with ArcPy?

Does anyone now how to add a group layer with Python in ArcGIS Desktop 10? I can use arcpy.mapping.AddLayer but surely this is only for an actual layer as opposed to a group layer. so far I have ...
8
votes
3answers
5k 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
4answers
2k views

Debugging ERROR 999999 in Raster to Polygon Scripting?

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 ...
8
votes
1answer
5k views

Problem with setValue() function in ArcGIS 10

I'm trying to add data to an attribute table in ArcGIS 10 using the following code: def make_floor_no( shapefile ): "Makes header for number of Floors (FLO) and calculates value" fieldName = ...
7
votes
2answers
363 views

Does ArcPy work for Engine or Server the same as Desktop?

I am contemplating a project where there is not going to be access to ArcGIS Desktop and wondering if Engine and/or Server install ArcPy and Python? Is this possible? Does anyone have an example?
4
votes
3answers
1k views

Automatically creating 2D-point features for ArcGIS Desktop from addresses in SQL database?

I currently have an SQL-Table which contains our buildings. I already added the table and now want to create features ( 2D-Points ) from that information. The biggest problem I have is that the "...
4
votes
2answers
9k views

Changing data source of layers with ArcPy?

How do I change the data source of all layers in a map document using ArcPy and Python?
9
votes
1answer
8k views

Creating script tool that will create copy of feature class and offset it by given distance using ArcPy?

I want to duplicate a polygon feature class and offset all of the polygons by about 10 feet in both the x and y directions. I asked if there was any way to do this last week, and I was informed that I ...
2
votes
1answer
586 views

Can I create a balloon callout on an address point on a published map?

Very new to this, so please excuse any ignorant question! I've created a vb.net app to open a published map in ArcReader. Have a few questions... First, I started with the query attribute sample ...
9
votes
6answers
7k views

Calculating orientation of each side of polygon using ArcPy?

I want to examine the orientation of each line in a polygon so that I can calculate their solar exposure. Each polygon represents a building, and has an associated height. For the moment, I just want ...
3
votes
3answers
2k views

How to create a copy of a feature class that is vertically and horizontally offset by a given distance?

I want to duplicate a polygon feature class and offset all of the polygons by about 10 feet in both the x and y directions. Is this possible to do using arcpy, or are there any geoprocessing tools ...
2
votes
1answer
214 views

Determining which feature is identified on ArcMap document using ArcPy?

I have to find out which feature is identified on the map, thus subsequently read the attributes of the feature, and then do some logic to plot a time series graph. Is it possible to find out which ...
7
votes
1answer
601 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
1answer
2k views

Setting units in ArcPy?

I want to calculate the area of each polygon in a shapefile. How do I control what the units of measurement are? def getArea(shapefile): """Print area of polygons""" Rows = ARCPY....
2
votes
3answers
2k views

Adding shapefile as layer in ArcMap via Python scripting?

I am trying to automate various tasks in ArcGIS Desktop (using ArcMap generally) with Python, and I keep needing a way to add a shapefile to the current map. (And then do stuff to it, but that's ...
7
votes
1answer
2k views

Updating Lat/Longs and actual position of point shapefile using arcpy.UpdateCursor()?

I have a point shapefile with over 3000 points that are updated frequently, when they are updated they need to have their lat/longs changed which is entered into the attribute table. When the lat/...
3
votes
5answers
2k views

script for automated line drawing procedure for set of start and end points [closed]

A colleague conducted a field survey and recorded the start and end points of the transects with a GPS. These points have been imported to ArcMap 9.3 as 2 point layers. Both layers have a "transect ...
1
vote
1answer
729 views

Run a python script every time the page is changed in Data Driven Pages? (ArcGIS 10)

I'm setting up a Data Driven Pages mapbook mxd for a series of parking locations. I have dynamic text that updates according to the current map sheet, but I also have text that needs to update using a ...
1
vote
3answers
2k views

Running ArcPy script on unix/linux server?

I've written some python scrips that use the ArcPy module to do some pretty intensive processing. I'd like to be able to run these on the fast unix server we have in our department so that I don't ...
9
votes
2answers
3k views

Changing from layout view to data view using ArcPy?

Is there a way to change from layout view to data view using Python and ArcMap 10? I would prefer to do it using ArcPy.
1
vote
2answers
11k views

KeyboardInterrupt doesn't work when arcgisscripting module is loaded

The KeyboardInterrupt exception -- thrown when Ctrl-C, or Ctrl-Break on some machines, are pressed in a Python console window -- is commonly used to gracefully break out of long-process loops, ...
6
votes
3answers
2k views

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
5answers
2k views

Converting Avenue scripts/extensions from ArcView 3.x to ArcPy for ArcGIS Desktop?

As a side project, I'm looking into the effort required to (semi-) automate conversion from Avenue to Python, instead of keeping ArcView 3.x around to run them.
5
votes
2answers
7k views

Assertion Error when attempting arcpy.mapping.AddLayer

Whenever I attempt to use AddLayer it gives me: Runtime error <type 'exceptions.AssertionError'> This is what I've been using: arcpy.mapping.AddLayer(MainDF, r"\\GEOGDATA\campusmapping\...
1
vote
1answer
955 views

How to create a pop-up box if a condition is true in a table? (ArcMap 10)

I'm creating a script that will grab layout data from a table for the current Building Number of the current building my map series is on. It works fine, but I need it to pop up a window if multiple ...
6
votes
1answer
3k views

Changing text element font size using ArcPy?

I need my script to change the font size of a text element if the string is too long to fit in the title section of the map. I've looked into it using ArcPy, but haven't had any luck. Does anyone ...
19
votes
4answers
16k views

Using ArcPy to zoom to selected feature?

Is there a way to zoom to the extent of a selected feature using the ArcPy module in ArcGIS Desktop 10.
12
votes
2answers
8k views

Making button that calls Python script as command rather than script tool?

I believe that in Arc9.3, commands could be created using VBA scripts. To add a custom command, you would navigate to Customize > Toolbars > Customize... and click UIControls. However, UIControls is ...
1
vote
2answers
1k views

unique value symbolize layers from a lookup table

I need to create a large number of Arcmap layer files (v9.3 or 10), perhaps a hundred, from lookup tables. I don't have to set the symbol patch itself, that can be random, but I do need the value and ...
4
votes
2answers
2k views

Building Python script that exports to several output files using ArcGIS Desktop?

I'm trying to build a Python Script that will receive one feature layer that will be clipped by several adjacent grid squares (each in a different shapefile) and output several shapefiles. Now, I've ...
6
votes
2answers
5k views

Changing page layout from portrait to landscape using ArcPy with ArcMap?

I need my script to access the Page Orientation property of the current MXD, and switch it from portrait to landscape (or back). I've looked through the ArcGIS 10 arcpy and arcpy.mapping ...
16
votes
3answers
6k views

Using ArcPy to get layer symbology?

Since ArcGIS 10 comes with the ArcPy package, I'm wondering it is possible to use ArcPy functions to get Symbology (i.e color, width...) of a layer?
16
votes
7answers
8k views

Bulk field renaming in file geodatabase? [duplicate]

I have a file geodatabase with several hundred feature classes in it. Some feature classes have a field that got named incorrectly, and it got named "SCHEMA_FEATURECLASS_ENTITY" instead of just ...
17
votes
1answer
6k views

Self terminating Python script in ArcMap?

I have tried sys.exit, but it doesn't seem to work in ArcMap 10. Anyone know how to do it?
8
votes
5answers
2k views

Will there be a Python API for ArcGIS Server?

It seems like an obvious next step given the big push towards Python in ArcGIS Desktop at 10.0. Are there any limitations of Python compared to javascript, flex, etc that would prevent ESRI from ...
13
votes
4answers
13k views

Will ArcGIS Desktop support latest Python 2.x or Python 3.x versions?

I'm curious to know whether ArcGIS Desktop 10.0 will support newer versions of Python than 2.6. And for that matter newer versions of NumPy (ie, 1.4, 1.5 etc). I'm sure that this documentation is on ...
8
votes
0answers
1k views

Seeking training resources in Python as applied to geodatabase management? [duplicate]

I've taken ESRI database courses, which have been helpful to my work but I also need training in Python as applied to geodatabase management?
19
votes
7answers
4k views

Code-completing/auto-completing ArcPy scripts using Notepad++ (external editor)?

I have been scripting in Python for ArcGIS 10, and so far I have just been using Notepad++. I like how the Python command line interface code-completes arcpy functionality for you, showing you your ...
19
votes
6answers
8k views

Documentation for ArcPy site-package?

Has anyone found any informative documentation about Esri's ArcPy Python module?
3
votes
1answer
547 views

Accessing MPS Atlas from Python with ArcPy?

I'm having trouble finding documentation on accessing MPS Atlas features using python in ArcGIS 10. I need to be able to modify dataframe manager properties, swap map sheets, etc. Is it part of ...
1
vote
3answers
1k views

an arcgisscripting method for sanitizing a filename?

Is there an arcgisscripting method for sanitizing a filename to get rid of characters which Arcgis barfs on, the meek hyphen - for example?
5
votes
2answers
8k views

Resolving ImportError: No module named arcgisscripting?

I am trying to run an ArcGIS python script from Eclipse and get the following message: ImportError: No module named arcgisscripting I can run this in IDLE... any ideas?
3
votes
3answers
1k views

How to stop ArcGIS Python script printing warnings and other outputs to the console

I've written a Python script using arcgisscripting to do various processing steps on some data. I'm planning to run it from a stand-alone command-line window (ie. not within ArcGIS at all) and, as ...
14
votes
5answers
17k views

Changing feature class and field aliases in bulk using ArcPy?

I have over a hundred FCs, each with 10 or 20 attributes to add or change the aliases for, two or more times a year. Needless to say, this is not something I'm going to grunt my way through. How can I ...