Make Grids and Graticules Layer (Cartography)

汇总

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 class/components are:

These feature classes can hold information for multiple grids. An eighth feature class (GRD_) contains organization 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.

用法

语法

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})
参数说明数据类型
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) or, if ArcMap is not active, the Cartographic Coordinate System set in the Environment Settings
    • The same AOI as the display

注意注意:

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.

注意注意:

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.

注意注意:

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

Group Layer
name
(可选)

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
(可选)

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
(可选)

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
(可选)

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
(可选)

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
(可选)

The grid template XML file creates grid components depicting coordinates or locations for a primary coordinates 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 systems 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
(可选)

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
(可选)

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 systems to NAD 1983 as well.

This is the first ancillary coordinate system.

Spatial Reference
ancillary_coordinate_system_2
(可选)

The grid template XML file creates grid components depicting coordinates or locations for a primary coordinates 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 systems to NAD 1983 as well.

This is the second ancillary coordinate system.

Spatial Reference
ancillary_coordinate_system_3
(可选)

The grid template XML file creates grid components depicting coordinates or locations for a primary coordinates 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 systems to NAD 1983 as well.

This is the third ancillary coordinate system.

Spatial Reference
ancillary_coordinate_system_4
(可选)

The grid template XML file creates grid components depicting coordinates or locations for a primary coordinates 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 systems to NAD 1983 as well.

This is the fourth ancillary coordinate system.

Spatial Reference

代码示例

Creates a cartographic grid.

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

# 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, "#", "#",
                                              "#", "#", "#")

环境

制图坐标系

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

参考比例

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

XY 容差

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

相关主题

许可信息

ArcView: 否
ArcEditor: 否
ArcInfo: 是

9/30/2010