Generate Grid From Area (Defense)

Summary

Generates a Gridded Reference Graphic (GRG) over a specified area with a custom size based on a bounding polygon.

Usage

  • The output grid will completely fill the input area.

  • The rotation of Input Feature determines the rotation of the output grid.

  • Cell labels will be added to a Grid field in the Output Feature Class.

  • The Output Feature Class is in the Web Mercator coordinate system.

Parameters

LabelExplanationData Type
Input Feature

The input polygon feature on which the GRG will be based.

Feature Set
Output Feature Class

The output polygon feature class containing the GRG.

Feature Class
Cell Width
(Optional)

The width of the cells. Measurement units are specified by the Cell Units parameter.

Double
Cell Height
(Optional)

The height of the cells. Measurement units are specified by the Cell Units parameter.

Double
Cell Units
(Optional)

Specifies the measurement units for cell width and height.

  • MetersThe unit will be meters. This is the default.
  • KilometersThe unit will be kilometers.
  • MilesThe unit will be miles.
  • Nautical milesThe unit will be nautical miles.
  • FeetThe unit will be feet.
  • US survey feetThe unit will be U.S. survey feet.
String
Label Start Position
(Optional)

Specifies the grid cell where labelling will start.

  • Upper leftThe label position will be the upper left. This is the default.
  • Lower leftThe label position will be the lower left.
  • Upper rightThe label position will be the upper right.
  • Lower rightThe label position will be the lower right.
String
Label Format
(Optional)

Specifies the labeling type for each grid cell.

  • Alpha-numericThe label will use an alpha character, a separator, and a number. This is the default.
  • Alpha-alphaThe label will use an alpha character, a separator, and an additional alpha character.
  • NumericThe label will be numeric.
String
Label Separator
(Optional)

Specifies the separator to be used between x- and y-values when the Label Format parameter is set to Alpha-alpha, for example, A-A, A-AA, AA-A.

  • HyphenThe label separator will be a hyphen. This is the default.
  • CommaThe label separator will be a comma.
  • PeriodThe label separator will be a period.
  • Forward slashThe label separator will be a forward slash.
String

arcpy.defense.GenerateGRGFromArea(in_feature, out_feature_class, {cell_width}, {cell_height}, {cell_units}, {label_start_position}, {label_format}, {label_separator})
NameExplanationData Type
in_feature

The input polygon feature on which the GRG will be based.

Feature Set
out_feature_class

The output polygon feature class containing the GRG.

Feature Class
cell_width
(Optional)

The width of the cells. Measurement units are specified by the Cell Units parameter.

Double
cell_height
(Optional)

The height of the cells. Measurement units are specified by the Cell Units parameter.

Double
cell_units
(Optional)

Specifies the measurement units for cell width and height.

  • METERSThe unit will be meters. This is the default.
  • KILOMETERSThe unit will be kilometers.
  • MILESThe unit will be miles.
  • NAUTICAL_MILESThe unit will be nautical miles.
  • FEETThe unit will be feet.
  • US_SURVEY_FEETThe unit will be U.S. survey feet.
String
label_start_position
(Optional)

Specifies the grid cell where labelling will start.

  • UPPER_LEFTThe label position will be the upper left. This is the default.
  • LOWER_LEFTThe label position will be the lower left.
  • UPPER_RIGHTThe label position will be the upper right.
  • LOWER_RIGHTThe label position will be the lower right.
String
label_format
(Optional)

Specifies the labeling type for each grid cell.

  • ALPHA_NUMERICThe label will use an alpha character, a separator, and a number. This is the default.
  • ALPHA_ALPHAThe label will use an alpha character, a separator, and an additional alpha character.
  • NUMERICThe label will be numeric.
String
label_separator
(Optional)

Specifies the separator to be used between x- and y-values when the label_format parameter is set to ALPHA_ALPHA, for example, A-A, A-AA, AA-A.

  • -The label separator will be a hyphen. This is the default.
  • ,The label separator will be a comma.
  • .The label separator will be a period.
  • /The label separator will be a forward slash.
String

Code sample

GenerateGRGFromArea example 1 (Python window)

The following Python window script demonstrates how to use the GenerateGRGFromArea function.

import arcpy
arcpy.env.workspace = r"C:/Data.gdb"
arcpy.GenerateGRGFromArea_defense(r"Area_layer",
                                  r"GenerateGRGFromArea",
                                  1000, 1000,
                                  "METERS",
                                  "UPPER_LEFT",
                                  "ALPHA_NUMERIC",
                                  "-")
GenerateGRGFromArea example 2 (stand-alone script)

The following example uses the GenereateGRGFromArea function in a sample workflow.

# Import system modules
import arcpy

# Set environment settings
arcpy.env.workspace = r"C:/Data.gdb"
arcpy.env.overwriteOutput = True

# Select airport area
airports = "Airports"
whereClause = "airport_code = 'CLT'"
clt_layer = arcpy.SelectLayerByAttribute_management(airports,
                                                    "NEW_SELECTION",
                                                    whereClause)

# Create GRG
arcpy.GenerateGRGFromArea_defense(clt_layer,
                                  r"GenerateGRGFromArea",
                                  1000, 1000,
                                  "METERS",
                                  "UPPER_LEFT",
                                  "ALPHA_NUMERIC",
                                  "-")

Licensing information

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

Related topics