-1

I'm struggling with visualizing a Excel dataset. I have a Excel data table containing a colum with XY coordinates of (multi)polygons, see the screenshot below. Now, I know that it is possible to visualize the data using the XY to Line function, however it is unclear for me how to implement multiple XY coordinates for a multipolygon instead of a simple line. Since my Excel data table contains 18.000 of these XY coordinates for polygons I have to automate it with a script, but I'm unfortunately not that experienced in it.

Is there a simple way that I don't know of yet to solve this?

1

2 Answers 2

1

You can do it with QGIS by importing the file as a Delimited text and defining that geometry column as a WKT geometry.

enter image description here

You can split the table in two and import two different files and later merge them into a Multypoligon file or change manually the Polygons to Multypoligons in the table.

4
  • While this may have solved YOUR immediate problem, it doesn't answer the question you asked. You asked specifically about ArcGIS Pro. Accepting this answer does little for someone else who may have the same question and doesn't accept "use a different software package" as an answer.
    – KHibma
    Commented Dec 19, 2019 at 13:33
  • The title of the question was changed from Excel XY to (Multi) Polygons to Excel XY to (Multi) Polygons using ArcGIS Pro. In the time of my answer, the answer WAS compliant with the question and DID answer the asked question. You can check the history.
    – mazinga
    Commented Dec 19, 2019 at 13:36
  • 1
    It may not have been in the title, but ArcGIS Pro was specified inside the question.
    – KHibma
    Commented Dec 19, 2019 at 13:59
  • @mazinga The first comment was directed mostly to the OP, who accepted a non-conforming answer. The original Question had an "Arcpro" in the body (which was corrected to the proper name), and is still tagged arcgis-desktop and arcgis-pro, so the Answer ought to have met that criteria, and certainly shouldn't have been marked correct.
    – Vince
    Commented Jan 12, 2020 at 16:20
1

Since the question was tagged with ArcGIS Desktop, I'll add an answer for that.

I'm not aware of a method in ArcGIS Pro to do this from the user interface, but a short script can be used to convert the WKT to a shapefile, or any other format supported by ArcGIS.

Note that I haven't specified a spatial reference. When using WGS84, ArcGIS did not let me insert my test geometries, maybe it works for you though. The script will probably also fail if the worksheet contains point or line features, because a shapefile can only contain one type of geometry. But since your sample only has polygons, you should be good. Polygons and Multipolygons can be mixed.

import arcpy
import os

# The name of the worksheet containing the data
xls = r'c:\temp\wkt.xls\Sheet1$'

# The name of the output shapefile
shp = r'c:\temp\wkt.shp'

# Create the shapefile if it does not exist yet
if not arcpy.Exists(shp):
    arcpy.management.CreateFeatureclass(os.path.dirname(shp), os.path.basename(shp), 'POLYGON', None)

# A cursor used for inserting rows
insertCursor = arcpy.da.InsertCursor(shp, ['SHAPE@'])

# Read data from the XLS row by row
with arcpy.da.SearchCursor(xls, ['*']) as searchCursor:
    for row in searchCursor:
        # Assuming the WKT is in the 2nd column (having index 1)
        shape = arcpy.FromWKT(row[1])
        insertCursor.insertRow((shape,))

del insertCursor
1
  • It's a grave error to not specify a SpatialReference during feature class construction. WGS84 data likely has negative values (in three of four quadrants), which would not function correctly without a 4326 constructor (which establishes a correct false origin at -400,-400), and would likely cause topology errors in Quadrant I due to truncation to thousandths of a degree. This is likely why the script didn't work for you.
    – Vince
    Commented Jan 12, 2020 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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