Make Grids And Graticules Layer (Cartography)

Summary

Creates a grouped layer of feature classes depicting grid, graticule, and border features using predefined cartographic specifications. Grid layers are ideal for advanced grid definitions which are scale and extent specific.

Each grid layer can be composed of a mask polygon, clip polygon, segments (line), gridlines (line), ticks (line), endpoints (point), points (point), and annotation feature classes. These components are stored as features in corresponding feature classes. These features classes are saved within a specified feature dataset in a geodatabase. There are seven feature classes that store the basic components of a grid. Each feature class is named with a three-letter prefix that helps identify the grid component the feature class holds. These feature classes/components are:

These feature classes can hold information for multiple grids. An eighth feature class (GRD_) contains organizational information, such as map name and grid types that are used to organize your grids.

The grid definition template is stored in a predefined XML file. This file stores specification properties for each grid, such as the number, color, and line weight of gridlines. When the definition template is applied, features are created according to the specification based on the current extent or extent of a selected feature (area of interest), scale, and coordinate systems.

Usage

Syntax

MakeGridsAndGraticulesLayer_cartography (in_template, in_aoi, input_feature_dataset, output_layer, {name}, {refscale}, {rotation}, {mask_size}, {xy_tolerance}, {primary_coordinate_system}, {configure_layout}, {ancillary_coordinate_system_1}, {ancillary_coordinate_system_2}, {ancillary_coordinate_system_3}, {ancillary_coordinate_system_4})
ParameterExplanationData Type
in_template

The XML grid definition template stores the specification's graphic properties for each grid layer. In addition to the graphic properties, which cannot be altered before execution, the definition has specific default values, exposed as parameters, that can be modified before execution.

Template files are located in the \ArcGIS\Desktop10.0\GridTemplates directory. Additional grid templates can be obtained and shared using the ArcGIS Resource Center.

The ArcGIS Production Mapping extension provides a grid designer that allows you to create new templates as well as modify existing ones.

File
in_aoi

The feature layer or x,y extent used to determine the extent of the grid layer created.

  • Feature layer—Indicates you can choose the layer to use for the area of interest. Only one selected feature will be used from this layer. For layers that have more than one feature, the tool will only create a grid layer based on the first feature. The first feature is based on object id. All remaining features are ignored.
  • Extent—Indicates you can use one of the following as the area of interest:
    • The default area of interest of the data frame.
    • As Specified Below—When you specify an extent by directly adding coordinates, a spatial reference for those coordinates is derived from the following, in order: (1) ArcMap's focused data frame (2) if ArcMap is not active, the Cartographic Coordinate System set in the Environment Settings.
    • The same AOI as the display.

NoteNote:

The only extent options valid for this tool are Default, As Specified Below, or Same as Display. Selecting any other option will result in an error.

Feature Layer; Extent
input_feature_dataset

The feature dataset that will store the features. Grid-specific feature classes will be created if they do not already exist. If they already exist, and a grid with the same name and type as the one being created also exists, it will be overwritten.

NoteNote:

A grid with the same name and type as the one created will always be overwritten, regardless of the GP environment.

Feature Dataset
output_layer

The grouped layer of feature classes depicting grid, graticule, and border features. Each grid layer can be composed of a mask polygon, a clip polygon, segments(line), gridlines(line), ticks(line), endpoints(point), points(point), and annotation feature classes.

NoteNote:

This is an in-memory layer that you must save in the ArcMap document or as a layer file.

Group Layer
name
(Optional)

The name for the cartographic grid created that allows for distinction between grids that are stored in the same feature dataset and set of feature classes, expressed in one of the following formats:

  • String—Enter a text string for the grid name.
  • Field—Enter a field from the feature layer. The value of the field for the selected feature is used to name the grid. An area of interest field name can be used when the Input Area of Interest parameter is defined as Feature Layer.

String; Field
refscale
(Optional)

The scale at which the grid is created and should be viewed. When the reference scale from the XML grid definition file is defined as Use Environment, the reference scale is derived in the following order:

  • The geoprocessing Reference Scale environment setting
  • The active data frame's reference scale
  • The active data frame's scale
  • The value from the XML grid definition file

Double
rotation
(Optional)

The rotation angle for the grid components. Rotation is used to provide annotation that is level with the page. Unless otherwise specified, rotation is calculated using the area of interest feature. When the rotation type from the XML grid definition file is defined as Use Environment, the rotation is derived in the following order:

  • The active data frame's rotation
  • The value from the XML grid definition file

Double
mask_size
(Optional)

The mask is a polygon feature that forms an outer ring around the extent of the neatline and is used to mask data that falls in the area reserved for coordinate labels. Mask size defines the width of the polygon mask feature in map or page units. The data frame may have to be resized to fit around the edge of the mask while including the coordinate labels.

Linear unit
xy_tolerance
(Optional)

The minimum tolerated distance between geodatabase features, expressed in linear units. This value is defaulted from the value set in the XML.

You can set the value higher for data with less coordinate accuracy and lower for data with extremely high accuracy. Features that fall within the set XY tolerance will be considered coincident.

Linear unit
primary_coordinate_system
(Optional)

The grid template XML file creates grid components depicting coordinates or locations for a primary coordinate system and up to four ancillary coordinate systems. The number of ancillary grids is specified by the file. You cannot add or delete ancillary coordinate systems. All coordinate systems specified must share a common geographic coordinate system. If you want to change the primary coordinate system to one that uses a different datum than the default, say for example, you change the coordinate system from one that uses WGS 1984 to one that uses NAD 1983, you must change each default ancillary coordinate system to NAD 1983 as well.

This is the primary coordinate system for the grid layer being created. Typically, it will be the coordinate system of the final product or data frame. This coordinate system must be a projected coordinate system.

Spatial Reference
configure_layout
(Optional)

Adjusts the data frame settings to ensure they match the grid layer. The data frame's coordinate system, scale, rotation, size, extent, and clipping may be altered to enforce consistency. This setting is only available when the tool is executed from ArcMap's layout view and is not being run in the background. The default is to have this check box unchecked.

  • CONFIGURELAYOUTIndicates data frame and layout are configured using grid settings.
  • NO_CONFIGURELAYOUTIndicates data frame and layout are not configured. This is the default.
Boolean
ancillary_coordinate_system_1
(Optional)

The grid template XML file creates grid components depicting coordinates or locations for a primary coordinate system and up to four ancillary coordinate systems. The number of ancillary grids is specified by the file. You cannot add or delete ancillary coordinate systems. All coordinate systems specified must share a common geographic coordinate system. If you want to change the primary coordinate system to one that uses a different datum than the default, say for example, you change the coordinate system from one that uses WGS 1984 to one that uses NAD 1983, you must change each default ancillary coordinate system to NAD 1983 as well.

This is the first ancillary coordinate system.

Spatial Reference
ancillary_coordinate_system_2
(Optional)

The grid template XML file creates grid components depicting coordinates or locations for a primary coordinate system and up to four ancillary coordinate systems. The number of ancillary grids is specified by the file. You cannot add or delete ancillary coordinate systems. All coordinate systems specified must share a common geographic coordinate system. If you want to change the primary coordinate system to one that uses a different datum than the default, say for example, you change the coordinate system from one that uses WGS 1984 to one that uses NAD 1983, you must change each default ancillary coordinate system to NAD 1983 as well.

This is the second ancillary coordinate system.

Spatial Reference
ancillary_coordinate_system_3
(Optional)

The grid template XML file creates grid components depicting coordinates or locations for a primary coordinate system and up to four ancillary coordinate systems. The number of ancillary grids is specified by the file. You cannot add or delete ancillary coordinate systems. All coordinate systems specified must share a common geographic coordinate system. If you want to change the primary coordinate system to one that uses a different datum than the default, say for example, you change the coordinate system from one that uses WGS 1984 to one that uses NAD 1983, you must change each default ancillary coordinate system to NAD 1983 as well.

This is the third ancillary coordinate system.

Spatial Reference
ancillary_coordinate_system_4
(Optional)

The grid template XML file creates grid components depicting coordinates or locations for a primary coordinate system and up to four ancillary coordinate systems. The number of ancillary grids is specified by the file. You cannot add or delete ancillary coordinate systems. All coordinate systems specified must share a common geographic coordinate system. If you want to change the primary coordinate system to one that uses a different datum than the default, say for example, you change the coordinate system from one that uses WGS 1984 to one that uses NAD 1983, you must change each default ancillary coordinate system to NAD 1983 as well.

This is the fourth ancillary coordinate system.

Spatial Reference

Code Sample

MakeGridsAndGraticulesLayer tool Example (stand-alone Python script)

This stand-alone script shows an example of using the MakeGridsAndGraticulesLayer tool to make a cartographic grid.

# Name: MakeGridsAndGraticulesLayer.py
# Description: Create grid for a selected area of interest in a file
# geodatabase

# Import system module
import arcpy

# Enabling logging of the results
arcpy.logHistory = True

# Enable background geoprocessing 
# arcpy.Command("force_run_in_background yes")  #uncomment this to run the
# GP tool in the background

# Set overwrite outputs of geoprocessing operations to true
arcpy.gp.overwriteOutput = 1

# Create a feature layer from the input area of interest feature class
# to pass to the Selection geoprocess below 
arcpy.MakeFeatureLayer_management("C:/Base_Data/AOIs.gdb/QUAD_24K",
                                  "QUAD_24K")

# Select a feature from the area of interest feature layer based on a
# definiton query (this query, formatted for a file geodatabase, has
# been adjusted for use in python, in particular the use of \ in
# conjunction with the double quotes surrounding the field name in the
# definition query)
arcpy.SelectLayerByAttribute_management("QUAD_24K", "NEW_SELECTION",
                                        "\"MSNAME\" = 'Swift Minnesota'")

# Set the values of the tool's parameters using one of the grid
# defintion XML files located under the GridTemplates directory
t = "C:/Program Files/ArcGIS/Desktop10.0/GridTemplates/Quad_24K_NAD83.xml"

in_aoi = "QUAD_24K"
input_feature_dataset = "C:/Python_Output/grid_layers.gdb/QUAD_24K"
output_layer = "QUAD_24K_NAD83_Grid"
name = "MSNAME"

# Process: Make Grids and Graticules Layer (the '#' indicates use
# default values)
arcpy.MakeGridsAndGraticulesLayer_cartography(t, in_aoi,
                                              input_feature_dataset,
                                              output_layer, name, "#", "#",
                                              "#", "#", "#")

Environments

Cartographic Coordinate System

The primary and ancillary coordinate systems parameters will use this setting when the XML grid definition file is defined as Use Environment.

Reference Scale

The Reference Scale parameter will use this setting when the XML grid definition file is defined as Use Environment.

XY Tolerance

The XY Tolerance parameter will use this setting when the XML grid definition file is defined as Use Environment.

Related Topics

Licensing Information

ArcView: No
ArcEditor: Yes
ArcInfo: Yes

11/11/2011