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:
- ANO_ is the annotation feature class.
- EPT_ is the endpoints feature class.
- GLN_ is the gridlines feature class.
- MSK_ is the masks feature class.
- PNT_ is the points feature class.
- SEG_ is the segments feature class.
- TKS_ is the segments feature class.
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
This tool is designed for projected maps that will be printed or exported. It is not meant for creating grids or graticules that dynamically update as the user navigates the map.
-
You must input an area of interest to determine the extent of the grid layer to be created. If you are using a feature layer to define the area of interest, it must be a polygon feature class or polygon layer.
-
In the Make Grids and Graticules Layer dialog box, once the Grid Template (XML file) parameter is defined, hover the pointer over or click the context-sensitive area immediately to the left of the parameter name to display grid type, description, rotation type, and scale type information for the defined XML grid definition template.
The grid template XML file specifies grid components depicting measurements or locations for primary and 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.
The grid template, area of interest, input feature dataset, and the primary and ancillary coordinate system parameters must use the same datum, for example, WGS 1984 or NAD 1983.
The grid template XML file creates grid components for up to four ancillary coordinate systems. The number of ancillary grids is specified by the XML file. You cannot add or delete ancillary coordinate systems, but you can override the default values.
The Primary Coordinate System must be a projected coordinate system.
Ancillary coordinate systems can be either a projected coordinate system or a geographic coordinate system.
The spatial reference of the Input Feature Dataset should have the same geographic coordinate system as specified by the grid template XML file.
The spatial reference of the Input Area of Interest should have the same geographic coordinate system as specified by the grid template XML file.
If you are accessing the tool from ArcMap, checking the Configure data frame and layout using grid settings check box ensures that the data frame on the layout is adjusted to best fit the created grid. The data frame's coordinate system, scale, rotation, size, extent, and clipping may be altered to match the XML grid specification. 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, which will not change any of your data frame properties.
When specifying a grid name that already exists in the output location, the existing grid will be overwritten.
The following parameter values are automatically derived from the grid template XML:
- Output Layer
- Name with the String Value
- Reference Scale
- Rotation
- Mask Size
- XY Tolerance
- Primary Coordinate System
- Ancillary Coordinate System
However, all of these default values can be overridden with new values.
Syntax
Parameter | Explanation | Data 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.1\GridTemplates directory. Additional grid templates can be obtained and shared using the ArcGIS Resource Center. The Esri 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.
Note: 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. Note: A grid with the same name and type as the one created will always be overwritten, regardless of the geoprocessing overwrite outputs setting. | 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.
Note: This is a temporary 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:
The grid name cannot contain any special characters. These include:
| 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:
| 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:
| 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. When the Primary Coordinate System in the XML grid definition file is defined as Use Environment, the Primary Coordinate System is derived in the following order:
In all cases user input takes the highest precedence. | 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.
| 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
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
# definition 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
# definition XML files located under the GridTemplates directory
t = "C:/Program Files/ArcGIS/Desktop10.1/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.