简体   繁体   中英

Inputting data from a text file into an ArcGIS shapefile attribute table

Before I begin coding, I would like to know if this is possible using arcpy and python.

I am trying to grab data from a text file and use that data to both populate my attribute table as well as create a polygon with the coordinates the text file provides. An example of the data is like so:

1867-Jan-01 Field value  Field Value  Field Value Field Value  Field Value
  52N  62W
  42N  52W
  32N  42W
  22N  32W
  12N  22W
  11N  12W
  10N  13W

The first line would be the attributes and all the coordinates underneath would become the polygon file. Using ArcMap 10.1, is this possible with arcpy and Python, and what direction should I go to accomplish this?

Thank you

Yes, this is possible.

Steps:

  1. Create a feature class and add fields using arcpy.
  2. Read your text file with open() or using Python's csv module if it is a CSV.
  3. Use the da.InsertCursor to populate geometry and attributes.

There is ESRI and/or Python documentation available online for each of these steps. Please take a stab at writing the code and post the code along with the error you are getting if you run into problems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM