ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

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
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

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

Create Features from Text File

  • Summary
  • Usage
  • Syntax
  • Code Sample
  • Environments
  • Licensing Information

Summary

Creates features using coordinates in text files.

Legacy:
This tool has been deprecated. For more information, see An overview of the Samples toolbox.

Usage

  • This tool will create a feature class based on coordinates given in a text file. Text files can be the output from the Write Features To Text File tool or from files you created.

  • Text files must be space delimited and will have different formats, depending on the geometry type.

  • It is not necessary to provide z- and m-values to point coordinates. Values of 1.#QNAN are given to unprovided z- and m-values.

  • If you use a thousands separator, the script will not work correctly. Instead of using 1,023.5, use 1023.5.

  • The script is able to handle various decimal separators. For example, data from the United States will often be in the format 1234.5, while data from Europe may be in the format 1234,5. Specify the decimal separator that corresponds to your data. If you have only integers, you may specify any separator you like.

  • The spatial reference parameter is optional. If you know the spatial reference of the input text coordinates, you can specify it; however, it is not required. If specified, the output feature class will have the spatial reference you selected.

  • Text files that represent points should be in the following format: The first line should contain the word Point to indicate the geometry type and the next lines should have the id and x,y,z,m coordinates of the points delimited by a space. The final line should contain the word END. Generically, it will look like this:

    Point
    id x y z m
    id x y z m
    ...
    END
    

    An example would be:

    Point
    0 1.0 1.0 3.0 1.4
    1 2.0 2.0 1.0 3.2
    2 3.0 1.0 2.0 2.5
    3 2.0 0.0 1.0 1.0
    END
    
  • Text files that represent multipoints should be in the following format: The first line should contain the word Multipoint to indicate the geometry type and the structure continues with the id number of the first group of points (id x y z m), followed by a zero. The points themselves follow. The final line should contain the word END. Generically, it will look like this:

    Multipoint
    multipoint_id 0
    pnt_id x y z m
    pnt_id x y z m
    ...
    multipoint_id 0
    pnt_id x y z m
    ...
    END
    

    An example would be:

    Multipoint
    0 0
    1 23.0 12.0 5.0 1.0
    2 34.0 32.0 4.0 1.0
    3 11.0 54.0 5.0 1.0
    1 0
    1 11.0 9.0 1.0 1.0
    2 5.0 5.5 1.0 1.0
    3 9.8 3.2 1.0 1.0
    END
    
  • Text files that represent lines should be in the following format: The first line should contain the word Polyline to indicate the geometry type and the structure continues with the id number of the first line, followed by the part number (in case it is a multipart line). The point coordinates follow. The final line should contain the word END. Generically, it will look like this:

    Polyline
    line_id part_number
    pnt_id x y z m
    pnt_id x y z m
    ...
    line_id part_number
    pnt_id x y z m
    pnt_id x y z m
    ...
    END
    

    The example below represents a line feature class with two features. Feature zero contains two parts.

    Polyline
    0 0
    0 1.0 1.0 0.0 0.0
    1 2.0 2.0 0.0 0.0
    2 3.0 3.0 0.0 0.0
    0 1
    0 4.0 4.0 0.0 0.0
    1 5.0 5.0 0.0 0.0
    2 6.0 6.0 0.0 0.0
    1 0
    0 1.0 6.0 0.0 0.0
    1 2.0 5.0 0.0 0.0
    2 3.0 4.0 0.0 0.0
    END
    
  • Text files that represent polygons should be in the following format: The first line should contain the word Polygon to indicate the geometry type and the structure continues with the id number of the first line, followed by the part number (in case it is a multipart polygon). Point coordinates for the respective part and feature follow. In the case of an interior ring, the word InteriorRing (no space) is written before the group of coordinates. Polygons should be closed, that is, the first and last points should be the same. The final line should contain the word END. Generically, it will look like this:

    Polygon
    polygon_id part_number
    pnt_id x y z m
    pnt_id x y z m
    ...
    InteriorRing
    pnt_id x y z m
    pnt_id x y z m
    ...
    polygon_id part_number
    pnt_id x y z m
    pnt_id x y z m
    ...
    END
    

    In the example below, there are two polygons. Polygon zero has two parts. The second part has an interior ring. Polygon one is a normal polygon.

    Polygon
    0 0
    0 5.0 5.0 1.#QNAN 1.#QNAN
    1 5.0 6.0 1.#QNAN 1.#QNAN
    2 6.0 6.0 1.#QNAN 1.#QNAN
    3 6.0 5.0 1.#QNAN 1.#QNAN
    4 5.0 5.0 1.#QNAN 1.#QNAN
    0 1
    0 0.0 0.0 1.#QNAN 1.#QNAN
    1 0.0 4.0 1.#QNAN 1.#QNAN
    2 4.0 4.0 1.#QNAN 1.#QNAN
    3 4.0 0.0 1.#QNAN 1.#QNAN
    4 0.0 0.0 1.#QNAN 1.#QNAN
    InteriorRing
    0 1.0 1.0 1.#QNAN 1.#QNAN
    1 1.0 3.0 1.#QNAN 1.#QNAN
    2 3.0 3.0 1.#QNAN 1.#QNAN
    3 3.0 1.0 1.#QNAN 1.#QNAN
    4 1.0 1.0 1.#QNAN 1.#QNAN
    1 0
    0 5.0 3.0 1.#QNAN 1.#QNAN
    1 5.0 4.0 1.#QNAN 1.#QNAN
    2 6.0 4.0 1.#QNAN 1.#QNAN
    3 6.0 3.0 1.#QNAN 1.#QNAN
    4 5.0 3.0 1.#QNAN 1.#QNAN
    END
    
  • All the examples above will work. Pass them into a text file, save the text file, and use it as input to the tool.

Syntax

CreateFeaturesFromTextFile_samples (input_text_file, input_decimal_separator, output_feature_class, {output_feature_class_spatial_reference})
ParameterExplanationData Type
input_text_file

A text file containing coordinates.

Text File
input_decimal_separator

The character that separates the whole number from the decimal. This may vary depending on the source of your data. If the coordinates take the form "1.5", your separator is a period.

String
output_feature_class

The output feature class.

Feature Class
output_feature_class_spatial_reference
(Optional)

The spatial reference of the output coordinates.

Spatial Reference

Code Sample

# Create geoprocessing dispatch object
import arcgisscripting
gp = arcgisscripting.create()
 
# Set up inputs to tool
inTxt = r"C:\temp\StreamPoints.txt"
inSep = "."
strms = r"C:\temp\Streams.shp"
 
# Run tool
gp.CreateFeaturesFromTextFile(inTxt, inSep, strms, "#")
 
# Use output from createfeatures tool as input to buffer
outFCbuf = r"C:\temp\StreamsBuf.shp"
gp.buffer(strms, "10 Unknown", "FULL", "ROUND", "NONE", "#")

Environments

  • Output XY Domain
  • Output Coordinate System

Licensing Information

  • ArcGIS for Desktop Basic: Yes
  • ArcGIS for Desktop Standard: Yes
  • ArcGIS for Desktop Advanced: Yes
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

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

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal