Make Defense Grids and Graticules (Defense Mapping)


Simplifies the grids creation workflow for Esri Defense Mapping by creating the grid feature dataset as well as the annotation mask features.



DefenseGrids_defense (in_template, in_aoi_layer, in_dataset, in_use_field, in_grid_field, in_grid_string, in_primary_coord, in_ancillary_coord, in_reference_scale, in_mask_margin, in_out_feature_class)
ParameterExplanationData Type

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 and behavior that can be modified before execution, exposed as parameters.

You can create new templates using the Grids and Graticules Designer which is part of Esri Production Mapping.


The feature layer that contains the selected feature used to determine the extent of the grid layer.

Feature Layer

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.

Feature Dataset

Indicates whether a field name or string is appended to the end of the name of each feature class in the feature dataset. This allows you to store multiple grids in the same feature dataset.

  • FIELDA field name from in_aoi_layer can be used as the grid name.
  • STRINGA custom string can be defined for the grid name.

The name of the field from in_aoi_layer whose value is used as the grid name. This value is appended to the name of each feature class in the grid dataset. It is recommended that the NRN field be used.


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.


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

A secondary coordinate system in which grid components can be created.

Spatial Reference

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


The amount of space that exists between the side of the annotation and the mask polygon feature. The units can be defined in page or map units. The value is composed of a number and unit of measurement.

Linear Unit

Feature class that contains the annotation masks.

Feature Class

Code Sample

DefenseGrids example (Python window)

This following Python window script demonstrates how to use the DefenseGrids tool.

import arcpy

# check out a Defense Mapping license    

# import the Defense Mapping toolbox - you may have to change this path
arcpy.ImportToolbox(r'C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Defense Mapping Tools.tbx')

# Local variables
in_layer_or_view = "TLM50_Index"
in_template = "C:\Program Files\ArcGIS\Desktop10.0\GridTemplates\DefenseMapping\TLM50_Single.xml"
in_aoi_layer = "TLM50_Index"
in_dataset = "C:\SampleData\10\Defense\Grids.gdb\TLM50D"
in_out_feature_class = "C:\SampleData\10\Defense\Grids.gdb\TLM50D\ANO_TLM50D_Masks_V795X22561"

# Select a feature in which to create the grid
arcpy.SelectLayerByAttribute_management("in_layer_or_view","NEW_SELECTION", "[NRN] = 'V795X22561' "

# Generate grid
arcpy.DefenseGrids_defense(in_template, in_aoi_layer, in_dataset, "FIELD", "NRN", "V795X22561", "PROJCS['GCS WGS 1984 UTM Zone 11N (Calculated)',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-117.0],PARAMETER['Scale_Factor',0.9996],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]];IsHighPrecision", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119521E-09;0.001;0.001;IsHighPrecision", 250, "50 Meters", in_out_feature_class)


Licensing Information

ArcView: No
ArcEditor: No
ArcInfo: Requires Defense Mapping