Show Navigation | Hide Navigation
You are here:
Geoprocessing tool reference > Data Management toolbox > Indexes toolset > Tools

Add Spatial Index (Data Management)

Release 9.2
Last modified November 29, 2010
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Tools"


Related Topics

Adds a spatial index to a shapefile, file geodatabase feature class, or ArcSDE feature class.

Spatial indexes are used by ArcGIS to quickly locate features that match a spatial query. For information on spatial indexes in geodatabases, see Setting spatial indexes. For information on spatial indexes in shapefiles, see Creating and updating indexes in shapefiles.


Usage tips

Command line syntax
An overview of the Command Line window
AddSpatialIndex_management <in_features> {spatial_grid_1} {spatial_grid_2} {spatial_grid_3}

Parameter Explanation Data Type
<in_features>

ArcSDE feature class, file geodatabase feature class, or shapefile to which a spatial index is to be added.

Feature Layer | Raster Catalog Layer
{spatial_grid_1}

The two-dimensional grid system that spans a layer, like a locator grid you might find on a common road map. The first, or lowest, grid level has the smallest cell size. One to three 2D grids (also referred to as grid levels), each with a distinct cell size, are created. Set the cell sizes of the other grids to 0 if you only want one; otherwise, set each level at least three times larger than the previous level.

Double
{spatial_grid_2}

The two-dimensional grid system that spans a layer, like a locator grid you might find on a common road map. The first, or lowest, grid level has the smallest cell size. One to three 2D grids (also referred to as grid levels), each with a distinct cell size, are created. Set the cell sizes of the other grids to 0 if you only want one; otherwise, set each level at least three times larger than the previous level.

Double
{spatial_grid_3}

The two-dimensional grid system that spans a layer, like a locator grid you might find on a common road map. The first, or lowest, grid level has the smallest cell size. One to three 2D grids (also referred to as grid levels), each with a distinct cell size, are created. Set the cell sizes of the other grids to 0 if you only want one; otherwise, set each level at least three times larger than the previous level.

Double
Data types for geoprocessing tool parameters


Command line example

addspatialindex_management Database Connections\Connection to esoracle.sde\LPI.Land\LPI.PLSSFirstDivision 1000 3000 10000

Scripting syntax
About getting started with writing geoprocessing scripts
AddSpatialIndex_management (in_features, spatial_grid_1, spatial_grid_2, spatial_grid_3)

Parameter Explanation Data Type
in_features (Required)

ArcSDE feature class, file geodatabase feature class, or shapefile to which a spatial index is to be added.

Feature Layer | Raster Catalog Layer
spatial_grid_1 (Optional)

The two-dimensional grid system that spans a layer, like a locator grid you might find on a common road map. The first, or lowest, grid level has the smallest cell size. One to three 2D grids (also referred to as grid levels), each with a distinct cell size, are created. Set the cell sizes of the other grids to 0 if you only want one; otherwise, set each level at least three times larger than the previous level.

Double
spatial_grid_2 (Optional)

The two-dimensional grid system that spans a layer, like a locator grid you might find on a common road map. The first, or lowest, grid level has the smallest cell size. One to three 2D grids (also referred to as grid levels), each with a distinct cell size, are created. Set the cell sizes of the other grids to 0 if you only want one; otherwise, set each level at least three times larger than the previous level.

Double
spatial_grid_3 (Optional)

The two-dimensional grid system that spans a layer, like a locator grid you might find on a common road map. The first, or lowest, grid level has the smallest cell size. One to three 2D grids (also referred to as grid levels), each with a distinct cell size, are created. Set the cell sizes of the other grids to 0 if you only want one; otherwise, set each level at least three times larger than the previous level.

Double

Data types for geoprocessing tool parameters


Script example

import arcgisscripting
gp = arcgisscripting.create()

# Set a default workspace
gp.workspace = "c:/test_data"

# Set a default workspace
gp.toolbox = "management"

try:
    # Add a spatial index to an SDE feature class.
    gp.addspatialindex ("Database Connections/Connection to esoracle.sde/LPI.Land\LPI.PLSSFirstDivision", 500)	

except:
    # If an error occurs when running addspatialindex, print out the error message.
    print gp.GetMessages(2)

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.