ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

ArcMap

  • 主页
  • 入门
  • 地图
  • 分析
  • 管理数据
  • 工具
  • 扩展模块

Create Features from Text File

  • 描述
  • 使用方法
  • 语法
  • 代码示例
  • 环境
  • 许可信息

描述

Creates features using coordinates in text files.

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

使用方法

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

语法

arcpy.samples.CreateFeaturesFromTextFile(input_text_file, input_decimal_separator, output_feature_class, {output_feature_class_spatial_reference})
参数说明数据类型
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
(可选)

The spatial reference of the output coordinates.

Spatial Reference

代码示例

# 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", "#")

环境

  • 输出 XY 属性域
  • 输出坐标系

许可信息

  • Basic: 是
  • Standard: 是
  • Advanced: 是

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS

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

关于 Esri

  • 关于我们
  • 招贤纳士
  • Esri 博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2021 Esri. | 隐私政策 | 法律声明