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

learn more… | top users | synonyms (1)

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? ...
4
votes
1answer
1k views

Repairing broken links for new paths of layers to shapefiles using ArcPy?

I have an .mxd with broken link layers and each layer has a different new path. I know the python script for repairing the broken links of the layers, but I want to put all the new paths of the layers ...
3
votes
1answer
666 views

ArcPy not running on standard console

I know this is a newbie ArcPy question, but here is the deal: While I'm inside ArcMap 10, the Python window gives me all output correctly, like this: >>> arcpy.env.workspace = ...
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 ...
5
votes
2answers
1k views

Calculating slope cell-by-cell in ArcPy

I am relatively new to the ArcGIS-Python environment and want to calculate elevation raster slope. But it says "ValueError: setting an array element with a sequence". Below code is what I have. Any ...
2
votes
1answer
216 views

What causes ArcPy RuntimeError: TextElementObject: Error in setting text?

I am trying to generate a map book with the following code that I downloaded but I keep getting an errror: *File "Y:\Planning\GIS Planning Analyst\projects\county_map_book\9_GenerateMapBook.py", ...
1
vote
1answer
208 views

Modifying a projection ArcMap 10.0 Arcpy

I have the need to project data from wgs84 to UTM 15N NAD1927 FOOT_US. I would like to have arcpy do this for me. I can project the data using one of ArcMaps predifined prj files in the Coordinates ...
2
votes
3answers
358 views

Is there a way to get the map document name/path from a published map service?

I have several map services published to ArcGIS Server 10.0 SP2 and I have layer metadata files exported to HTML that I want to link to the layers in the map service. Currently the metadata HTML ...
1
vote
0answers
81 views

getSelectedExtent not working on joined layers

When joining layers the getSelectedExtent function in ArcPy fails to get the extent. Unjoining the layers and running it yeilds the expected result. The joined layers are all located on an SDE. Is ...
2
votes
1answer
136 views

Locate DTEDs from one layer that intersect a polygon in another layer

I'm new to the GIS world, and using ArcGIS 10, so please forgive me if this is a simple question. I have DTED files (level 2) that I have placed into a mosaic dataset, and I'm trying to determine ...
2
votes
1answer
168 views

Using ArcPy to fetch Information from a .GDB

I am new to GIS and I would appreciate if you could guide me a little. I have a .gdb folder with data and I need to process that data to find educational institutions which are within say X Km of the ...
15
votes
2answers
2k views

Exporting table to XYZ ASCII file via ArcPy?

I'm looking for a way to export an ArcGIS table (created with the Sample tool) to a text file via ArcPy. I can do this in ArcGIS via the context menu by right-clicking the table, but have not found ...
6
votes
2answers
751 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 ...
1
vote
3answers
1k views

Unable to Provide Input for a MultiValue Parameter Script Tool

I have the following script: #Import ArcPy site package import arcpy from arcpy import env from arcpy import Raster from arcpy.sa import ZonalStatistics from arcpy.sa import CreateConstantRaster # ...
3
votes
0answers
145 views

Creating Data Frame or Group Layer using ArcPy? [duplicate]

I am attempting to write some Python code which creates a blank data frame or group layer which can then be populated with other layers. I'm at a loss as to how to do this since I'm somewhat new to ...
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 ...
10
votes
3answers
995 views

Efficiently finding the 1st order neighbors of 200k polygons

For every one of the 208,781 Census block groups, I'd like to retrieve the FIPS IDs of all of its 1st order neighbors. I have all the TIGER boundaries downloaded and merged into a single 1GB ...
13
votes
2answers
2k views

How to smooth/interpolate a raster in python using GDAL?

This is my first post so please feel free to critique where necessary. Background: I am developing in Python and using GDAL from OSGEO to manipulate and interact with rasters and shapefiles. ...
8
votes
2answers
345 views

How to determine storage type (ST_Geom/Oracle) from arcpy/python

We're migrating some feature classes from SDELOB (or some older binary format) to ST_Geometry. As we write our arcpy script to use the ESRI Migrate Storage Tool we'd like to test whether or not ...
7
votes
1answer
942 views

Inserting newlines in Rectangle Text elements via ArcPy causes overlap?

I ran across an issue the other day when I tried to use ArcPython's mapping module to edit rectangle text elements with newlines (\n) in an ArcMap document. Here's what the output looked like: ...
4
votes
2answers
182 views

Spawning a process from ArcGIS ToolValidator

I attempted to spawn a separate process from the ArcGIS ToolValidator script. Unfortunately, it launches another instance of ArcCatalog. What is going on behind the scenes that causes ArcCatalog to ...
1
vote
2answers
302 views

GetCount_management From ArcGIS ToolValidator

We want to check if features are empty in the ToolValidator. When you call GetCount_managment() and background processing is on, there is a popup from our validation step. Is there a different ...
8
votes
2answers
2k views

Using arcpy.SetParameter() with Python Script Tool published as Geoprocessing Service?

I have a script that needs to be published to ArcGIS Server as a geoprocessing service. This script computes a set of records in table form. I need to set an output parameter so that it returns the ...
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, ...
2
votes
1answer
336 views

ArcPy replaceDataSource to an SDE raster catalog error

New to Python! I'm trying to re-path a multitude of rasters currently the workspace is a folder, the intended workspace is a raster catalog in an SDE database - using the replaceDataSource method I'm ...
3
votes
1answer
649 views

ArcGIS Select Analysis using Unique Values from Field

I am trying to create separate shapefile using Select analysis with ArcPy by doing an SQL query to create them based on a unique value from the field. I want to create a list of the unique values in ...
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 ...
7
votes
1answer
1k views

Edit End Points in Polyline (Python/ArcMap10)

I am trying to make a polyline endpoint snapping tool in python. using a Search Cursor I read in the values to an array of line objects (which contain the feature id of the line, and two "EndPoint" ...
6
votes
1answer
396 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 ...
3
votes
1answer
194 views

arcpy pydev 3rd party toolbox intellisense

I am just newly started to look at arcpy and i see that it has good intellisense for system toolboxes by default and also if you import a custom toolbox - the intellisense gets update also - however ...
11
votes
1answer
351 views

File Validation using ArcPy

I have a script which scans a directory and outputs basic raster data information such as the file name, format, number of bands, and etc. I need a way to make it so if the directory does not contain ...
4
votes
2answers
385 views

Finding Band Count in Rasters using ArcPy

I'm having troubles finding the band count for my raster files using ArcPy. I need to first list all the raster files in a directory, and then display the band count for each file. I am able to list ...
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 ...
5
votes
1answer
865 views

How to check whether a fc is registered as versioned or not using python

How can I check whether or not a feature class is versioned using python? I'm trying to register feature classes using a python script. Before I do this I need to check whether a feature class is ...
1
vote
1answer
3k views

Using the arcpy.UpdateCursor to delete rows doesn't delete based on counter

I am trying to delete rows from a shapefile using arcpy.UpdateCursor. The first thing I did was get a unique list of values from the key field "PolyGUID", then I iterate that list doing a ...
3
votes
1answer
850 views

Workaround for Raster data input in ArcGIS Server Geoprocessing Service

UPDATE I have accomplished the Python script, but only tested in desktop environment, i.e. ArcMap. #Import ArcPy site package module import arcpy from arcpy import env from arcpy import Extent from ...
7
votes
3answers
952 views

How to determine on which side of a line a polygon feature falls?

I have parcel data intersecting line data. In the parcel data there are some parcels that don't intersect the line. How could I programmatically figure out if the non-intersecting parcel is on the ...
3
votes
2answers
5k views

How to sort a feature class and then calculate a sequential ID field?

I am in ArcMap and I want to sort the records based on a field and then do a Calculate Field with an auto-incrementing value with the sort in-place. Any ideas? It looks like I could get an update ...
4
votes
1answer
2k views

Batch conversion of netCDF to Raster in ArcGIS using Python

I'm having trouble using the Dimension Values (Optional) argument in arcpy.MakeNetCDFRasterLayer_md. Whatever I seem to do the output raster is always the first layer which is the default value. ...
0
votes
1answer
895 views

How to use variable field name in arcpy.SearchCursor?

I have code that says fld = fieldName rows = arcpy.SearchCursor(fc) for row in rows: x = row.fld How do I use a variable for my field name in python ArcGIS 10 on windows? Thanks.
1
vote
1answer
601 views

help writing a python script

Hi I need help with writing a script: The task I have a point feature class of graffiti incidents and a polygon feature class of patrol zones with some empty attributes already created for you. I ...
5
votes
3answers
1k 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 ...
1
vote
2answers
201 views

ArcPy Result Object Associated with Currently Running Script

We are at the end of a Python script using ArcPy. We can crawl around ArcPy to get information, but is there any way to get a result object for our currently running script? My motivation is to use ...
4
votes
1answer
383 views

How to write code for downloading a file in ArcGIS 10?

I have an offline database which has lat & long coordinates. The functionality I need to provide is to have a (latitude, longitude) point which will have country and city in it. Once the user has ...
2
votes
1answer
157 views

ArcGIS Geoprocessing Script - Calling External EXE Works in Desktop - Causes GP Service to Quit Abruptly

I have an interesting problem on my hands... I have a generic python script that does a bunch of geoprocessing functions using the standard arcgisscripting module (Yes, I am still at 9.3.1). At one ...
6
votes
1answer
647 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 ...
4
votes
1answer
3k views

How to add field in attribute table by python

I have research on the question (How to add an attribute field to an existing Shapefile via Python) but could not implement it. If you can give me examples on how to add field name in attribute ...
1
vote
1answer
195 views

Odd behavior with arcpy.mapping.PublishMSDToServer

When I publish an MSD to ArcGIS Server 10.0 manually in ArcCatalog (through right-click context menu) or through the web interface, the service is created properly. When I use ...
9
votes
3answers
8k views

How to create a shapefile in ArcGIS 10 using arcpy?

How can I create a shapefile using Python in ArcGIS 10? I have lat & long. From this I need Python code which will create a shapefile and display it in ArcGIS 10. Thanks.
2
votes
1answer
317 views

How can I remove WMS layers from mxds using arcpy?

I'm trying to remove WMS layers from an mxd using arcpy. I can successfully remove "MapServer" type services using the below code, but not WMS? Here is an example mxd (zipped) with two different WMS ...