Сводка
Generates a grids and graticules layer for ArcGIS Defense Mapping products. This tool supports the creation of single, dual, and zipper zone grids. It simplifies grid creation by automatically populating several parameters based on a selected feature and an input grid type. It determines zone type and the correct grid .xml template used to generate the grids and graticules layer. It also determines a grid's primary and ancillary coordinate system and estimates reference scale and annotation mask margin.
Использование
Grid templates can be found in the <installation directory>\GridTemplates\DefenseMapping directory.
The Input Area of Interest parameter value can only be a single polygon feature from a single feature layer. With a stand-alone script, you must use the Select Layer By Attribute tool.
При указании имени сетки, которое уже существует в выходном местоположении, существующая сетка будет перезаписана.
The Primary Coordinate System parameter value is predefined in all Defense Mapping grid templates.
The Ancillary Coordinate System parameter value is often predefined in Defense Mapping grid templates. For dual grid templates, you must manually choose the appropriate projected coordinate system.
During execution, this tool calls the Feature Outline Masks tool and creates a mask that is used to hide features along the edge of the grid. The mask improves cartographic display of annotation along the grid's edge. The output of the Feature Outline Masks tool is added to the grid Feature Dataset parameter value.
Синтаксис
arcpy.defense.DefenseGrids(in_aoi_features, grid_type, template, in_workspace, in_dataset, use_field, grid_field, grid_string, primary_coord, ancillary_coord, reference_scale, mask_margin, anno_feature_class, {update_data_frame})
Параметр | Объяснение | Тип данных |
in_aoi_features | The layer that contains the selected feature used to determine the extent of the grid layer. The grid is created within this extent. | Layer |
grid_type | Specifies the type of Defense Mapping cartographic product that will include the grid. This tool uses the in_aoi_features parameter extent and the grid_type parameter value to populate the template parameter with an appropriate grid .xml file. If grid_type is set to NONE, the template parameter will not automatically populate. Set grid_type to NONE to manually choose a template .xml file.
| String |
template | The grid .xml definition template that stores graphic properties for each grid layer. You can create a template using the Production Mapping Grids and Graticules Designer or using existing templates in the ArcGIS installation directory. | File |
in_workspace | The workspace used in conjunction with the input feature dataset. | Workspace |
in_dataset | The feature dataset that will store the features. If no feature dataset exists, it will be created. Grid-specific feature classes will also 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, the existing grid will be overwritten. | String |
use_field | Specifies whether a field name or a string will be 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.
| Boolean |
grid_field | The field from in_aoi_features 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 you use the NRN field. | Field |
grid_string | The cartographic grid that allows for distinction between grids stored in the same feature dataset and set of feature classes. | String |
primary_coord | The coordinate system of 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 |
ancillary_coord | A secondary coordinate system in which grid components can be created. | Spatial Reference |
reference_scale | The scale at which the grid is created and will 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 |
mask_margin | The amount of space that exists between the side of the annotation and the edge of the mask polygon feature. The units can be defined in page or map units. The default value depends on the specification (either 0.2 or 0.7 millimeters). This tool creates a mask with the default value, in page units, from the edge of any part of the grid annotation. | Linear unit |
anno_feature_class | The name of the annotation mask feature class. The default annotation mask name uses the following naming convention: ANO_Masks_<feature dataset>_<grid name>. If the annotation mask name does not display a default name, it is likely that Grid Name Field is blank or null. | String |
update_data_frame (Дополнительный) | Specifies whether the data frame and layout will be configured using the grid settings.
| Boolean |
Пример кода
DefenseGrids example 1 (stand-alone script)
The following code example demonstrates how to execute the DefenseGrids function.
# Set gp environment
gridsWorkspace="c:/data/grids.gdb"
arcpy.env.workspace=gridsWorkspace
arcpy.env.addOutputsToMap=True
# variables for tools
idx="C:/Program Files (x86)/ArcGIS/EsriDefenseMapping/Desktop10.2/ReferenceData/MapIndex.mdb/MapIndex/TLM50_Index"
idxLayer = "TLM50_Index"
product="TLM50"
inTemplate="C:/Program Files (x86)/ArcGIS/Desktop10.2/GridTemplates/DefenseMapping/TLM50_Single.xml"
inDataset = "TLM50D"
outFeatures = "ANO_TLM50D_Masks_V795X22561"
useField="FIELD"
gridField="NRN"
coordsys="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"
ancillaryCoord="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"
refScale=50000
maskMargin="50 Meters"
where="[NRN] = 'V795X22561'"
# Make a feature layer from the TLM50_Index feature class
arcpy.MakeFeatureLayer_management(idx,idxLayer)
# Select a feature in which to create the grid
arcpy.SelectLayerByAttribute_management(idxLayer,"NEW_SELECTION", where)
# Generate grid
arcpy.DefenseGrids_defense(idxLayer, product, inTemplate, gridsWorkspace, inDataset, useField, gridField, "", coordsys, ancillaryCoord, refScale, maskMargin, outFeatures)
DefenseGrids example 2 (stand-alone script)
The following code example demonstrates how to execute the DefenseGrids function.
# Running Defense Grids tool allowing the tool validation to populate parameters
# Importing arcpy module
import arcpy
# Checking out Defense extension
arcpy.CheckOutExtension('defense')
# Setting envioronment to allow overwrite output
arcpy.env.overwriteOutput = 1
# Setting variables for necessay data
area_of_interest = r'C:\DefenseProductFiles\ReferenceData\MapIndex.gdb\MapIndex\TLM50_Index'
grid_workspace = r'C:\Data\Grids.gdb'
# Setting variables for input parameters
grid_type = 'TM50'
grid_dataset = 'Grids'
# Createing AOI feature layer
selection_query = "NRN = 'V795X16573'"
arcpy.management.MakeFeatureLayer(area_of_interest, 'AOI')
arcpy.management.SelectLayerByAttribute('AOI', 'NEW_SELECTION', selection_query)
# Calling Defense Grids tool
arcpy.defense.DefenseGrids('AOI', grid_type, '#', grid_workspace, grid_dataset, 'FIELD', '#', '', '#', '#', '#', '#', '#', 'NO_CONFIGURELAYOUT')
# Checking in Defense extensison
arcpy.CheckInExtension('defense')
Параметры среды
Информация о лицензиях
- Basic: Нет
- Standard: Нет
- Advanced: Требуется Defense Mapping