ArcGIS Desktop

  • Documentation
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Export Feature Attribute To ASCII

  • Summary
  • Illustration
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Exports feature class coordinates and attribute values to a space, comma, or semicolon-delimited ASCII text file.

Illustration

Export Feature Attribute To ASCII tool illustration
Coordinates (X and Y) and user-specified feature attributes are written to an ASCII text file.

Usage

  • This tool may be used to export data for analysis with external software packages.

  • The X and Y coordinate values are written to the text file with eight significant digits of precision. Floating-point attribute values are written to the text file with six significant digits.

  • If this tool is part of a custom model tool, the output text file will only appear in the Results window if it is set as a model parameter prior to running the tool.

  • When null values are encountered for a field value, they will be written to the output text file as NULL.

  • Caution:

    When using shapefiles, keep in mind that they cannot store null values. Tools or other procedures that create shapefiles from nonshapefile inputs may store or interpret null values as zero. In some cases, nulls are stored as very large negative values in shapefiles. This can lead to unexpected results. See Geoprocessing considerations for shapefile output for more information.

Syntax

ExportXYv_stats (Input_Feature_Class, Value_Field, Delimiter, Output_ASCII_File, Add_Field_Names_to_Output)
ParameterExplanationData Type
Input_Feature_Class

The feature class from which to export feature coordinates and attribute values.

Feature Layer
Value_Field
[Value_Field,...]

The field or fields in the input feature class containing the values to export to an ASCII text file.

Field
Delimiter

Specifies how feature coordinates and attribute values will be separated in the output ASCII file.

  • SPACE —Feature coordinates and attribute values will be separated by a space in the output.
  • COMMA —Feature coordinates and attribute values will be separated by a comma in the output.
  • SEMI-COLON —Feature coordinates and attribute values will be separated by a semicolon in the output.
String
Output_ASCII_File

The ASCII text file that will contain the feature coordinate and attribute values.

File
Add_Field_Names_to_Output
  • NO_FIELD_NAMES —No field names will be included in the output text file (default).
  • ADD_FIELD_NAMES —Field names will be written to the output text file.
Boolean

Code sample

ExportFeatureAttributeToASCII example (Python window)

The following Python Window script demonstrates how to use the ExportFeatureAttributeToASCII tool.

import arcpy
arcpy.env.workspace = r"c:\data"
arcpy.ExportXYv_stats("AidsByCaCnty.shp","HEPRATE", "SPACE","aidsbycacnty.txt","ADD_FIELD_NAMES")
ExportFeatureAttributeToASCII example (stand-alone Python script)

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

# Export feature locations and attributes to an ASCII text file
 
# Import system modules
import arcpy
 
# Local variables...
workspace = "c:/data"
input_features = "AidsByCaCnty.shp"
export_ASCII = "aidsbycacnty.txt"
 
try:
    # Set the current workspace (to avoid having to specify the full path to the feature classes each time)
    arcpy.env.workspace = workspace
 
    # Process: Export Feature Attribute to ASCII...
    arcpy.ExportXYv_stats(input_features, "HEPRATE", "SPACE", export_ASCII, "NO_FIELD_NAMES")
 
except:
    # If an error occurred when running the tool, print out the error message.
    print(arcpy.GetMessages())

Environments

  • Current Workspace
  • Scratch Workspace
  • Output Coordinate System
  • Geographic Transformations

Licensing information

  • ArcGIS Desktop Basic: Yes
  • ArcGIS Desktop Standard: Yes
  • ArcGIS Desktop Advanced: Yes

Related topics

  • An overview of the Utilities toolset
  • An overview of the Spatial Statistics toolbox
  • Add XY Coordinates

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2018 Esri. | Privacy | Legal