Grid Index Features (Cartography)

Summary

Creates a grid of rectangular of polygon features that can be used as an index to specify pages for a map book using Data Driven Pages. A grid can be created that only includes polygon features that intersect another feature layer.

Usage

Syntax

GridIndexFeatures_cartography (out_feature_class, {in_features}, {intersect_feature}, {use_page_unit}, {scale}, {polygon_width}, {polygon_height}, {origin_coord}, {number_rows}, {number_columns}, {starting_page_number}, {label_from_origin})
ParameterExplanationData Type
out_feature_class

Resulting feature class of polygon index features.

The coordinate system of the ouput feature class is determined in this order.

  • If a coordinate system is specified by the Output Coordinate System variable in the Environment Settings the output feature class will use this coordinate system.
  • If a coordinate system is not specified by the Output Coordinate System the output feature class will use the coordinate system of the active data frame (ArcMap is open).
  • If a coordinate system is not specified by the Output Coordinate System and there is no active data frame (ArcMap is not open) the ouput feature class will use the coordinate system of the first input feature.
  • If a coordinate system is not specified by the Output Coordinate System, there is no active data frame (ArcMap is not open) and there is no specified input features the coordinate system of the ouput feature class will be unknown.
Feature Class
in_features
[in_features,...]
(Optional)

Input features can be used to define the extent of the polygon grid that is created.

Feature Layer
intersect_feature
(Optional)

Limits the output grid feature class to only areas that intersect input feature layers or datasets. When input features are specified, the default value is INTERSECTFEATURE. The intersection of input features will be used to create index features.

  • INTERSECTFEATURELimits the output grid feature class to only areas that intersect input feature layers or datasets.
  • NO_INTERSECTFEATUREOutput grid feature class is created using specified coordinates, rows, and columns.
Boolean
use_page_unit
(Optional)

Indicates whether index polygon size input is in page units. The default is NO_USEPAGEUNIT. The tool uses map units by default.

  • USEPAGEUNITIndex polygon height and width are calculated in page units.
  • NO_USEPAGEUNITIndex polygon height and width are calculated in map units.
Boolean
scale
(Optional)

Scale must be specified if the index polygon height and width are to be calculated in page units. If the tool is being used outside of an active ArcMap session the default scale value is 1.

Long
polygon_width
(Optional)

Width of the index polygon specifed in either map or page units. If page units are being used the default value is 1 inch. If map units are being used the default is 1 degree.

Linear unit
polygon_height
(Optional)

Height of the index polygon specifed in either map or page units. If page units are being used the default value is 1 inch. If map units are being used the default is 1 degree.

Linear unit
origin_coord
(Optional)

Coordinate for the lower left origin of the output grid feature class. If input features are specified the default value is determined by the extent of the union of extents for these features. If there are no input features specified, the default coordinates are 0 and 0.

Point
number_rows
(Optional)

Number of rows to create in the y direction from the point of origin. The default is 10.

Long
number_columns
(Optional)

Number of columns to create in the x direction from the point of origin. The default is 10.

Long
starting_page_number
(Optional)

Each grid index feature is assigned a sequential page number starting with a specified starting page number. The default is 1.

Long
label_from_origin
(Optional)

Page numbers (labels) starting with the specified starting page number (default is 1) begins with the cell in the lower left corner of the output grid. The default is NO_LABELFROMORIGIN.

  • LABELFROMORIGINPage numbers (labels) starting with the specified starting page number (default is 1) begins with the polygon feature in the lower left corner of the output grid.
  • NO_LABELFROMORIGINPage numbers (labels) starting with the specified starting page number (default is 1) begins with the cell in the upper left corner of the output grid.
Boolean

Code Sample

GridIndexFeatures tool Example #1 (Python Window)

Creates GridIndexFeatures using the intersection of input features and specified index feature dimensions in map units.

import arcpy
from arcpy import env
arcpy.env.workspace = "C:\data\ProjectData.gdb"
arcpy.GridIndexFeatures_cartography("gridIndexFeatures","poly", "", "", "",
                                    "1000 meters","1000 meters")
GridIndexFeatures tool Example #2 (Python Window)

Creates GridIndexFeatures using the entire extent of input features and specified index feature dimensions in page units.

import arcpy
from arcpy import env
arcpy.env.workspace = "C:\data\ProjectData.gdb"
arcpy.GridIndexFeatures_cartography("gridIndexFeatures","poly",
                                    "NO_INTERSECTFEATURE","USEPAGEUNIT",
                                    "100000", "5 inches","5 inches")
GridIndexFeatures tool Example #3 (Python Window)

Creates GridIndexFeatures using the intersection of input features, specified index feature dimensions in map units, and 5 as the starting page number.

import arcpy
from arcpy import env
arcpy.env.workspace = "C:\data\ProjectData.gdb"
arcpy.GridIndexFeatures_cartography("gridIndexFeatures","poly", "", "", "",
                                    "1000 meters", "1000 meters", "", "",
                                    "", "5")
GridIndexFeatures tool Example #4 (Python Window)

Creates GridIndexFeatures by specifying the origin coordinates, the index feature dimensions in map units, the number of rows, and the number of columns.

import arcpy
from arcpy import env
arcpy.env.workspace = "C:\data\ProjectData.gdb"
arcpy.GridIndexFeatures_cartography("gridIndexFeatures", "", "", "", "",
                                    "1000 meters","1000 meters",
                                    "-6000000 -1600000", "15", "20",)
GridIndexFeatures tool Example #5 (Python Window)

Creates GridIndexFeatures by specifying the origin coordinates, the index feature dimensions in page units, the number of rows, the number of columns, 5 as the starting page number, and labeling to start at the origin.

import arcpy
from arcpy import env
arcpy.env.workspace = "C:\data\ProjectData.gdb"
arcpy.GridIndexFeatures_cartography("gridIndexFeatures", "", "", "USEPAGEUNIT",
                                    "100000", "5 inches", "5 inches",
                                    "-6000000 -1600000", "5",
                                    "LABELFROMORIGIN")
GridIndexFeatures tool Example #1 (Stand-alone Python script)

Creates GridIndexFeatures using the intersection of input features and specified index feature dimensions in map units.

# gridindexfeatures_example1.py
# Description: Creates Grid Index Features using the intersection of input
# features and specified index feature dimensions in map units

# Import system modules
import arcpy
from arcpy import env

# Set environment settings
arcpy.env.workspace = "C:\data\ProjectData.gdb"

# Set local variables
outFeatureClass = "gridIndexFeatures"
inFeatures = "poly"
polygonWidth = "1000 meters"
polygonHeight= "1000 meters"

# Execute GridIndexFeatures
arcpy.GridIndexFeatures_cartography(outFeatureClass,inFeatures, "", "", "",
                                    polygonWidth, polygonHeight)
GridIndexFeatures tool Example #2 (Stand-alone Python script)

Creates GridIndexFeatures using the entire extent of input features and specified index feature dimensions in page units.

# gridindexfeatures_example2.py
# Description: Creates Grid Index Features using the entire extent of input
# features and specified index feature dimensions in page units

# Import system modules
import arcpy
from arcpy import env

# Set environment settings
arcpy.env.workspace = "C:\data\ProjectData.gdb"

# Set local variables
outFeatureClass = "gridIndexFeatures"
inFeatures = "poly"
noIntersect = "NO_INTERSECTFEATURE"
usePageUnit = "USEPAGEUNIT"
scale = "100000"
polygonWidth = "5 inches"
polygonHeight= "5 inches"

# Execute GridIndexFeatures
arcpy.GridIndexFeatures_cartography(outFeatureClass, inFeatures, noIntersect,
                                    usePageUnit, scale, polygonWidth,
                                    polygonHeight)
GridIndexFeatures tool Example #3 (Stand-alone Python script)

Creates GridIndexFeatures using the intersection of input features, specified index feature dimensions in map units, and 5 as the starting page number.

# gridindexfeatures_example3.py
# Description: Creates Grid Index Features using the intersection of input
# features, specified index feature dimensions in map units and 5 as the 
# starting page number

# Import system modules
import arcpy
from arcpy import env

# Set environment settings
arcpy.env.workspace = "C:\data\ProjectData.gdb"

# Set local variables
outFeatureClass = "gridIndexFeatures"
inFeatures = "poly"
polygonWidth = "1000 meters"
polygonHeight = "1000 meters"
startingPageNum = "5"

# Execute GridIndexFeatures
arcpy.GridIndexFeatures_cartography(outFeatureClass,inFeatures, "", "", "",
                                    polygonWidth, polygonHeight, "", "", "" 
                                    startingPageNum)
GridIndexFeatures tool Example #4 (Stand-alone Python script)

Creates GridIndexFeatures by specifying the origin coordinates, the index feature dimensions in map units, the number of rows, and the number of columns.

# gridindexfeatures_example4.py
# Description: Creates Grid Index Features by specifying the origin
# coordinates, the index feature dimensions in map units, the number of
# rows and the number of columns

# Import system modules
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "C:\data\ProjectData.gdb"
env.outputCoordinateSystem = r"C:\Program Files\ArcGIS\Desktop10.0\Coordinate Systems\
Projected Coordinate Systems\Continental\North America\North America Albers Equal Area Conic.prj"

# Set local variables
outFeatureClass = "gridIndexFeatures"
polygonWidth = "1000 meters"
polygonHeight= "1000 meters"
originCoord = "-6000000 -1600000"
numberRows = "15"
numberColumns = "20"

# Execute GridIndexFeatures
arcpy.GridIndexFeatures_cartography(outFeatureClass, "", "", "", "",
                                    polygonWidth, polygonHeight, originCoord,
                                    numberRows, numberColumns)
GridIndexFeatures tool Example #5 (Stand-alone Python script)

Creates GridIndexFeatures by specifying the origin coordinates, the index feature dimensions in page units, the number of rows, the number of columns, 5 as the starting page number, and labeling to start at the origin.

# gridindexfeatures_example5.py
# Description: Creates Grid Index Features by specifying the origin
# coordinates, the index feature dimensions in page units, the number of
# rows, the number of columns, 5 as the starting page number and labeling
# to start at the origin

# Import system modules
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "C:\data\ProjectData.gdb"
env.outputCoordinateSystem = r"C:\Program Files\ArcGIS\Desktop10.0\Coordinate Systems\
Projected Coordinate Systems\Continental\North America\North America Albers Equal Area Conic.prj"

# Set local variables
outFeatureClass = "gridIndexFeatures"
usePageUnit = "USEPAGEUNIT"
scale = "100000"
polygonWidth = "1000 meters"
polygonHeight= "1000 meters"
originCoord = "-6000000 -1600000"
numberRows = "15"
numberColumns = "20"
startingPageNum = "5"
labeling = "LABELFROMORIGIN"


# Execute GridIndexFeatures
arcpy.GridIndexFeatures_cartography(outFeatureClass, "", "", usePageUnit,
                                    scale, polygonWidth, polygonHeight,
                                    originCoord, numberRows, numberColumns,
                                    startingPageNum, labeling)

Environments

Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes

11/11/2011