I have a CSV file with one of the columns containing an array of consecutive lat/longs like the following:


What is the easiest way for me to import this into ArcGIS as a polygon? I would also like to maintain the other data in the CSV in the other columns that are associated with an individual polygon (row in the CSV).

  • What have you tried? That looks like it would be easily convertable to an Array of Point objects in Python (via JSON). – Vince Dec 2 '17 at 1:27
  • Best way is to use arcpy, read the CSV file, create an insert pointer for your feature class and insert the array as WKT. Do you have experience in writing arcpy scripts? How is you CSV file structured? Can you give an example for several rows? – Thomas Dec 2 '17 at 5:41
  • @Chris i don't know anything about your fields. which delimited you use to separate fields in the csv? – BBG_GIS Dec 2 '17 at 15:50

Use arcpy. Create an array. Loop into the nested list. Create an array of points. Use this array to create a polygon feature class.

import arcpy
Mylist = [[[42.87596410238256, -70.57617187499999], [41.77131167976407, -70.048828125], [41.64007838467894, -72.0703125]
              , [42.5530802889558, -73.212890625], [43.068887774169625, -72.421875],
           [42.87596410238256, -70.57617187499999]]]

# A list of features and coordinate pairs
feature_info = Mylist

# A list that will hold each of the Polygon objects
features = []

for feature in feature_info:
    # Create a Polygon object based on the array of points
    # Append to the list of Polygon objects
            arcpy.Array([arcpy.Point(*coords) for coords in feature])))

arcpy.CopyFeatures_management(features, "D:/test.gdb/result")
  • @onakua It's not answer of this question.The asker wants to create a polygon with a nested list. – BBG_GIS Dec 2 '17 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.