ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • 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 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

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

ASCII 3D To Feature Class

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

Summary

Imports 3D features from one or more ASCII files stored in XYZ, XYZI, or GENERATE formats into a new feature class.

Illustration

ASCII 3D To Feature Class example

Usage

  • All input files must be of the same format and geometry type.

  • XYZ and XYZI formats support header lines and treat the first row that starts with three consecutive numbers as the beginning of the point records. Both formats can store points, lines, and polygons, but each file may only contain one single-part line or polygon feature. Polygon features must close, with the coordinates of the last vertex being identical to that of the first, and must not self-intersect.

  • XYZ files store x, y, and z coordinates as floating-point values, where each row represents a distinct point record. The XYZ coordinates can be followed by alphanumeric entries, but this information will not be transferred to the resulting feature class.

  • XYZI files store x, y, z, and intensity measures. Intensity values are stored in a binary large object (BLOB) field for multipatch outputs.

    Note:

    If the ASCII file is in XYZI format but the intensity measures are not desired, choose XYZ. This will skip the intensity value when reading the files.

  • The GENERATE format does not support header lines, but it provides an ID for each point along with XYZ coordinates, and the last line of the file is optionally noted using the END keyword:

    id x y z
    id x y z
    .
    .
    END
  • The GENERATE format supports multiple features per file. For lines and polygons, the END keyword signals the end of a feature, and each feature must be a single-part feature. Two END keywords in a row indicates the end of the file.

    id
    x y z
    x y z
    x y z
    END
    id
    x y z
    x y z
    END
    END
    Note:

    Polygons should be oriented clockwise, have no self-intersections, and be closed (that is, the last vertex is equal to the first). If one of these conditions is not met, the output polygon will not be valid. The Check Geometry tool can be used to validate the resulting features, and the Repair Geometry tool can be used to correct the errors.

Syntax

arcpy.ddd.ASCII3DToFeatureClass(input, in_file_type, out_feature_class, out_geometry_type, {z_factor}, {input_coordinate_system}, {average_point_spacing}, {file_suffix}, {decimal_separator})
ParameterExplanationData Type
input
[input,...]

The ASCII files or folders containing data in XYZ, XYZI (with lidar intensity), or 3D GENERATE format. All input files must be in the same format. If a folder is specified, the File Suffix parameter becomes required, and all the files that have the same extension as the specified suffix will be processed.

In the tool dialog window, a folder can also be specified as an input by selecting the desired folder in Windows Explorer and dragging it into the parameter's input box.

Folder; File
in_file_type

The format of the ASCII files that will be converted to a feature class.

  • XYZ —Text file that contain geometry information stored as XYZ coordinates.
  • XYZI —Text files that contain XYZ coordinates alongside intensity measurements.
  • GENERATE —Text files structured in the Generate format.
String
out_feature_class

The feature class that will be produced by this tool.

Feature Class
out_geometry_type

The geometry type of the output feature class.

  • MULTIPOINT —Multipoints are recommended the input data contains a large number of points and attributes per feature are not required.
  • POINT —Each XYZ coordinate will produce one point feature.
  • POLYLINE —The output will contain polyline features.
  • POLYGON —The output will contain polygon features.
String
z_factor
(Optional)

The factor by which z-values will be multiplied. This is typically used to convert Z linear units to match XY linear units. The default is 1, which leaves elevation values unchanged. This parameter is disabled if the spatial reference of the input surface has a Z datum with a specified linear unit.

Double
input_coordinate_system
(Optional)

The coordinate system of the input data. The default is an Unknown Coordinate System. If specified, the output may or may not be projected into a different coordinate system. This depends the whether the geoprocessing environment has a coordinate system defined for the location of the target feature class.

Coordinate System
average_point_spacing
(Optional)

The average planimetric distance between points of the input. This parameter is only used when the output geometry is set to MULTIPOINT, and its function is to provide a means for grouping the points together. This value is used in conjunction with the points per shape limit to construct a virtual tile system used to group the points. The tile system's origin is based on the domain of the target feature class. Specify the spacing in the horizontal units of the target feature class.

Double
file_suffix
(Optional)

The suffix of the files to import from an input folder. This parameter is required when a folder is specified as input.

String
decimal_separator
(Optional)

The decimal character used in the text file to differentiate the integer of a number from its fractional part.

  • DECIMAL_POINT —A point is used as the decimal character. This is the default.
  • DECIMAL_COMMA —A comma is used as the decimal character.
String

Code sample

ASCII3DToFeatureClass example 1 (Python window)

The following sample demonstrates the use of this tool in the Python window.

import arcpy
from arcpy import env

arcpy.CheckOutExtension("3D")
env.workspace = "C:/data"
#Create spatial reference object using WKID
sr = arcpy.SpatialReference(32136)
arcpy.ASCII3DToFeatureClass_3d("masspntz.gen", "GENERATE", "elevation_points.shp", 
                               "MULTIPOINT", z_factor=3.28, 
                               input_coordinate_system=sr, average_point_spacing=2.5)
ASCII3DToFeatureClass example 2 (stand-alone script)

The following sample demonstrates the use of this tool in a stand-alone Python script.

'''****************************************************************************
Name: ASCII3D_to_Feature_Class Example
Description: Creates a TIN surface using XYZI files in a folder and breaklines
             imported from ASCII files.
****************************************************************************'''
# Import system modules`
import arcpy
from arcpy import env
import exceptions, sys, traceback

try:
    arcpy.CheckOutExtension("3D")
    # Set environment settings
    env.workspace = "C:/data"
    # Define the spatial reference using the name
    sr = arcpy.SpatialReference("Hawaii Albers Equal Area Conic")
    #Create the elevation points
    arcpy.ddd.ASCII3DToFeatureClass("Elevation Points", "XYZI", 
                                   "elevation_points.shp",
                                   "MULTIPOINT", z_factor=3.28, 
                                   input_coordinate_system=sr, 
                                   average_point_spacing=2.5,
                                   file_suffix="XYZ")
    #Create the break lines
    arcpy.ddd.ASCII3DToFeatureClass("brklines.gen", "GENERATE", 
                                   "breaklines.shp", 
                                   "POLYLINE", z_factor=3.28, 
                                   input_coordinate_system=sr)
    arcpy.ddd.CreateTin("elevation_tin", sr, 
                        [["breaklines.shp", "Shape", "hardline"],
                        ["elevation_points.shp", "Shape", "masspoints"]],
                        "CONSTRAINED_DELAUNAY")

except arcpy.ExecuteError:
    print arcpy.GetMessages()
except:
    # Get the traceback object
    tb = sys.exc_info()[2]
    tbinfo = traceback.format_tb(tb)[0]
    # Concatenate error information into message string
    pymsg = 'PYTHON ERRORS:\nTraceback info:\n{0}\nError Info:\n{1}'\
          .format(tbinfo, str(sys.exc_info()[1]))
    msgs = 'ArcPy ERRORS:\n {0}\n'.format(arcpy.GetMessages(2))
    # Return python error messages for script tool or Python Window
    arcpy.AddError(pymsg)
    arcpy.AddError(msgs)

Environments

  • Current Workspace
  • Extent
  • Output Coordinate System
  • Geographic Transformations
  • XY Resolution
  • XY Tolerance
  • Z Resolution
  • Z Tolerance
  • Output CONFIG Keyword
  • Auto Commit

Licensing information

  • Basic: Requires 3D Analyst
  • Standard: Requires 3D Analyst
  • Advanced: Requires 3D Analyst

Related topics

  • An overview of the Conversion toolset
  • Fundamentals of geoprocessing with the ArcGIS 3D Analyst extension

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

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