Grid Index Features (Cartography)

Summary

Creates a grid of rectangular polygon features that can be used as an index to specify pages in a spatial map series. A grid can be created that includes only polygon features that intersect another feature layer.

Usage

  • The coordinate system of the output feature class is determined in the following order:

    • If a coordinate system is specified by the Output Coordinate System environment, the output feature class will use this coordinate system.
    • If a coordinate system is not specified by the Output Coordinate System environment, the output feature class will use the coordinate system of the active map or map frame.
    • If a coordinate system is not specified by the Output Coordinate System environment and there is no active map (ArcGIS Pro is not open), the output feature class will use the coordinate system of the first input feature.
    • If a coordinate system is not specified by the Output Coordinate System environment, there is no active map (ArcGIS Pro is not open), and there are no specified input features, the coordinate system of the output feature class will be unknown.
  • The Input Features parameter can be points, lines, polygons, or rasters.

  • If you use the Use Page Unit and Scale parameter, the Map Scale parameter is required.

  • When using the tool dialog box, changing the polygon width or height values when the Polygon Grid Origin Coordinate parameter has been specified causes the number of rows and columns to change automatically. Rows and columns are automatically calculated based on the grid origin coordinates of the feature class extent. If the origin x,y coordinates are modified in a way that increases the total extent, the appropriate number of rows and columns are updated. If the total extent is decreased, the changes will be ignored and the full extent of the features will be used

  • When you add the Input Features parameter, the Polygon Grid Origin Coordinate parameter value is automatically calculated.

  • When Use Page Unit and Scale is checked, the Polygon Width and Polygon Height units automatically change to the page units set in the active map frame. If you are using the tool outside an ArcGIS Pro session, the units default to inches. Although you have the option to specify map units, such as meters or miles, use units that are appropriate for your page.

  • When Use Page Unit and Scale is checked, the map scale defaults to the scale value of the active map frame on the page layout. If you are using the tool outside an ArcGIS Pro session, the scale defaults to 1.

  • For best results, all input feature layers and feature classes should be in the same coordinate system as the map or map frame, or if you are using the tool outside an ArcGIS Pro session, all input feature layers and feature classes should be in the same coordinate system as the first input feature layer or feature class in the list.

Syntax

GridIndexFeatures(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

The resulting feature class of polygon index features.

The coordinate system of the output feature class is determined in the following order:

  • If a coordinate system is specified by the Output Coordinate System environment, the output feature class will use this coordinate system.
  • If a coordinate system is not specified by the Output Coordinate System environment, the output feature class will use the coordinate system of the active map (ArcGIS Pro is open).
  • If a coordinate system is not specified by the Output Coordinate System environment, and there is no active map (ArcGIS Pro is not open), the output feature class will use the coordinate system of the first input feature.
  • If a coordinate system is not specified by the Output Coordinate System environment, there is no active map (ArcGIS Pro is not open), and there are no specified input features, the coordinate system of the output feature class will be unknown.
Feature Class
in_features
[in_features,...]
(Optional)

The input features to be used to define the extent of the polygon grid that will be created.

Feature Layer; Raster Layer
intersect_feature
(Optional)

Limits the output grid feature class to areas that intersect input feature layers or datasets. The intersection of input features will be used to create index features.

  • INTERSECTFEATURELimits the output grid feature class to areas that intersect input feature layers or datasets. When input features are specified, this is the default.
  • NO_INTERSECTFEATUREAn output grid feature class is created using specified coordinates, rows, and columns.
Boolean
use_page_unit
(Optional)

Specifies whether index polygon size input is in page units.

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

The map scale. The scale must be specified if the index polygon height and width are to be calculated in page units. If the tool is used outside an active ArcGIS Pro session, the default scale value is 1.

Long
polygon_width
(Optional)

The width of the index polygon specified in either map or page units. If page units are used, the default value is 1 inch. If map units are used, the default value is 1 degree.

Linear Unit
polygon_height
(Optional)

The height of the index polygon specified in either map or page units. If page units are used, the default value is 1 inch. If map units are used, the default value is 1 degree.

Linear Unit
origin_coord
(Optional)

The coordinate value 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)

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

Long
number_columns
(Optional)

The 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)

Specifies where page numbers (labels) begin.

  • LABELFROMORIGINPage numbers (labels) begin with the polygon feature in the lower left corner of the output grid.
  • NO_LABELFROMORIGINPage numbers (labels) begin with the polygon feature in the upper left corner of the output grid. This is the default.
Boolean

Code sample

GridIndexFeatures example 1 (Python window)

The following example creates grid index features using the intersection of input features and specified index feature dimensions in map units.

import arcpy
arcpy.env.workspace = "C:\data\ProjectData.gdb"
arcpy.GridIndexFeatures_cartography("gridIndexFeatures","poly", "", "", "",
                                    "1000 meters", "1000 meters")
GridIndexFeatures example 2 (Python window)

The following example creates grid index features using the entire extent of input features and specified index feature dimensions in page units.

import arcpy
arcpy.env.workspace = "C:\data\ProjectData.gdb"
arcpy.GridIndexFeatures_cartography("gridIndexFeatures","poly",
                                    "NO_INTERSECTFEATURE", "USEPAGEUNIT",
                                    "100000", "5 inches", "5 inches")
GridIndexFeatures example 3 (Python window)

The following example 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 arcpy
arcpy.env.workspace = "C:\data\ProjectData.gdb"
arcpy.GridIndexFeatures_cartography("gridIndexFeatures","poly", "", "", "",
                                    "1000 meters", "1000 meters", "", "",
                                    "", "5")
GridIndexFeatures example 4 (Python window)

The following example creates grid index features by specifying the origin coordinates, index feature dimensions in map units, number of rows, and number of columns.

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

The following example 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 arcpy
arcpy.env.workspace = "C:\data\ProjectData.gdb"
arcpy.GridIndexFeatures_cartography("gridIndexFeatures", "", "", "USEPAGEUNIT",
                                    "100000", "5 inches", "5 inches",
                                    "-6000000 -1600000", "15", "20", "5",
                                    "LABELFROMORIGIN")
GridIndexFeatures example 6 (stand-alone script)

The following example creates grid index features 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
# Author: ESRI

# 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 example 7 (stand-alone script)

The following example creates grid index features 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
# Author: ESRI

# 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 example 8 (stand-alone script)

The following example creates grid index features 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
# Author: ESRI

# 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 example 9 (stand-alone script)

The following example creates grid index features by specifying the origin coordinates, index feature dimensions in map units, number of rows, and 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
# Author: ESRI

# Import system modules
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "C:\data\ProjectData.gdb"
env.outputCoordinateSystem = arcpy.SpatialReference("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 example 10 (stand-alone script)

The following example 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.

# 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
# Author: ESRI

# Import system modules
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "C:\data\ProjectData.gdb"
env.outputCoordinateSystem = arcpy.SpatialReference("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)

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics