I was wondering if there was an easy way to get the WKT values of a selected polygon to be able to copy and paste? I know there's a way to input WKT and get a polygon, but I need the reverse direction. My company sends polygons into a mapping program of a regulatory agency and the easiest way to get polygons into their mapping program is to copy and paste WKT values, otherwise it's a multi-step process of getting shapefiles converted into their program. The agency used to have an add-in to put into ArcMap so that when we selected a polygon, it would pop up with WKT values to copy and paste, but it looks like they don't plan to create that add-in for ArcGIS Pro (and the ArcMap one does not work in Pro).
Solved! Go to Solution.
@McKenzieBredemeyer If you can add script tool to a toolbox, this is about as simple as you can make it. Add one parameter for your input feature. Add this script to the tool and save, To run select a polygon, add the feature layer as the input. It outputs the WKT in the Messages window.
import arcpy
infc = arcpy.GetParameterAsText(0)
for row in arcpy.da.SearchCursor(infc, ["SHAPE@WKT"]):
arcpy.AddMessage(row[0])
If you don't mind a bit of python, a Search Cursor with the special SHAPE@WKT field token will return that for every feature you need.
I would prefer to have something that doesn't work with Python, at least not on the front-facing side of it. My coworkers that will primarily be the ones needing the WKT information do not know python at all, and I only have a basic knowledge of Python to set a tool up for them.
@McKenzieBredemeyer If you can add script tool to a toolbox, this is about as simple as you can make it. Add one parameter for your input feature. Add this script to the tool and save, To run select a polygon, add the feature layer as the input. It outputs the WKT in the Messages window.
import arcpy
infc = arcpy.GetParameterAsText(0)
for row in arcpy.da.SearchCursor(infc, ["SHAPE@WKT"]):
arcpy.AddMessage(row[0])
Thank you so much, this is so helpful.