0

I am trying to post in Map view (AGP) XY values near vertices of a polygon.

I have tried converting polygons to points but then it gives me only 1 point in the middle of the polygon, if however all points would be extracted then I could post (probably) XY near the points (ex vertices).

I know there is Vertices to Points in Geoprocessing (but I don't have it licensed)

What are your thoughts on this?

7
  • 2
    Any license level will permit vertex extraction via an ArcPy DA SearchCursor.
    – Vince
    Commented Jun 16, 2023 at 17:38
  • 1
    The documentation has a tool script that exports polyline vertices.
    – Vince
    Commented Jun 16, 2023 at 20:19
  • 1
    What do you mean "post" points? The [post] tag refers to the HTTP POST method.
    – user2856
    Commented Jun 16, 2023 at 21:56
  • 1
    When you say "post" , "postin" and "posting"... what are you talking about? Are you trying to add X Y values as points to a dataset?
    – user2856
    Commented Jun 17, 2023 at 11:00
  • 1
    If you're trying to add X Y values as points to a dataset and ensure those points fall on polygon vertices, then use snapping.
    – user2856
    Commented Jun 17, 2023 at 11:27

3 Answers 3

3

The XY pairs which make up the vertices of a polygon are within the paths of ring features in the geometry properties. Given you do not have a license to run Feature Vertices to Points, you will need to access the geometry properties of the feature in order to capture the coordinate values. Once you have the coordinate values, they can be displayed in a number of ways. To access the geometry properties, you can use the data access (da) module of arcpy, to cursor through each feature, and then loop through the rings and paths of each geometry object (Shape field).

with arcpy.da.SearchCursor(in_fc, [OID@", "SHAPE@"]) as sc:
    for row in sc:
        feature_id = row[0]
        polygon_geometry = row[1]

With the geometry object in hand, you can then read the geometries.

for part in polygon_geometry:
    for pnt in part:
        if pnt:
            print("{}, {}".format(pnt.X, pnt.Y))

Now that you have access to the coordinates and ID for each polygon, you could easily build a table with the coordinate values and store the ID value to later reference the Polygon feature class to possibly label each vertex, or display as part of the feature's pop-up, etc.

2

Another alternative if you don't want to code it is to download the WhiteboxTools-ArcGIS. It works in ArcGIS Pro but is limited to shapefile format, so if your polygon data is in a file geodatabase (the best format) you'll need to export it out to shapefile format. Then you can run it on the Extract Nodes tool. I think the name is misleading but reading the help file it clearly states its extracting out vertices.

Here is a screen shot of some output:

Sample data

Zero coding required and not limited by license level.

0

You can also extract vertices in QGIS.

Just load the data into QGIS and run the Extract Vertices tool.

Vector> Geometry Tools> Extract Vertices...

No license needed.

Extract vertices QGIS 3

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