Geodatabase To Shape (Defense Mapping)

Summary

Exports one or more feature classes in a geodatabase to shapefiles.

This tool has three modes of converting feature classes to shapefiles: defense, generic, and MGCP. Each mode controls how the output shapefiles are named. The defense and MGCP export modes follow Esri Defense Mapping data model requirements. Generic mode uses the same logic as Feature Class To Feature Class.

Usage

Syntax

GeodatabaseToShape_defense (in_features, in_shape_folder, in_output_type, in_conversion_method, in_create_empties)
ParameterExplanationData Type
in_features
[in_features,...]

The features used to create the shapefiles.

Feature Layer
in_shape_folder

The target location for the shapefiles.

Folder
in_output_type

Indicates what method will be used to export coded domain values.

  • VALUESExports coded domain values as raw values. This is the default.
  • DESCRIPTIONSExports coded domain values using their descriptions rather than raw values.
String
in_conversion_method

Indicates which conversion method will be applied.

  • DEFENSE_BY_SUBTYPECreates a shapefile based on subtype name. Exports attributes applicable to that subtype. Removes trailing underscores from fields. This is the default.
  • DEFENSE_BY_FEATURECLASSCreates a shapefile based on the feature class name. Removes trailing underscores from fields.
  • GENERIC_BY_FEATURECLASS Creates a shapefile for each feature class selected. The shapefile's name matches the feature class name.
  • GENERIC_BY_SUBTYPE Creates a shapefile for each subtype of the feature class selected. The shapefile's name matches the subtype name.
  • MGCP Creates a shapefile based on the feature class subtype. File is named using the geometry type and feature code. For example, the River subtype in the WatrcrsL feature class would be exported to a shapefile called LBH140.
String
in_create_empties

Indicates that the tool will create empty shapefiles if the input Feature Classes are also empty.

  • CREATE_EMPTIESDo no create empty shapefiles if the corresponding feature classes to export are empty
  • NO_CREATE_EMPTIESCreate empty shapefiles if the corresponding feature classes to export are empty. This is the default.
Boolean

Code Sample

GeodatabaseToShape example (stand-alone script)

The following stand-alone script demonstrates how to use the GeodatabaseToShape tool.

# Name: GeodatabaseToShape_Example.py
# Description: Exports feature classes from an MGCP workspace to shapefiles
# Requirements: Defense Mapping extension

# Import arcpy module
import arcpy

# Check out a DefenseMapping extension license
arcpy.CheckOutExtension("defense")

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

# Local variables
inFeatures = r"C:\Data\Defense\MGCP_TRD3.mdb\MGCP\AerofacA;C:\Data\Defense\MGCP_TRD3.mdb\MGCP\AerofacP;C:\Data\Defense\MGCP_TRD3.mdb\MGCP\AgristrA;C:\Data\Defense\MGCP_TRD3.mdb\MGCP\AgristrP"
inShapeFolder = r"C:\Data\Shapefiles"
inOutputType = "Values"
inConversionMethod = "MGCP"

# Execute Geodatabase To Shape function
arcpy.GeodatabaseToShape_defense(inFeatures, inShapeFolder, inOutputType, inConversionMethod)

# Check in the Defense Mapping extension
arcpy.CheckInExtension("defense")

Environments

Related Topics

Licensing Information

ArcView: No
ArcEditor: Requires Defense Mapping
ArcInfo: Requires Defense Mapping

12/20/2012