Count How many vertices

4942
5
Jump to solution
02-05-2015 12:31 PM
PROBERT68
Frequent Contributor

Is there a way for me to run a tool or script to call how many vertices of a file geodatabase polygon ?

0 Kudos
1 Solution

Accepted Solutions
MicahBabinski
Occasional Contributor III

Yes, Tim is right on with that GP tool. Try:

# Import arcpy
import arcpy

# Define the tool parameters
in_fc = r"[path_to_your_polygon_fc]"
out_fc = r"[path_to_point_fc]"

# Convert the feature vertices to points
arcpy.FeatureVerticesToPoints_management(in_fc, out_fc)

# Count the features and print the answer
print(int(arcpy.GetCount_management(out_fc).getOutput(0)))

I hope it works for you!

Warm Regards,

Micah Babinski

View solution in original post

0 Kudos
5 Replies
TimWitt2
MVP Alum

Robert,

maybe this can help? ArcGIS Help 10.1

Tim

0 Kudos
OwenEarley
Occasional Contributor III

You could use the Feature Vertices To Points (Data Management) tool - ArcGIS Help 10.1

Make sure to use the ALL option:

Summary

Creates a feature class containing points generated from specified vertices or locations of the input features.

Illustration

Feature Vertices To Points
Feature Vertices To Points

0 Kudos
MicahBabinski
Occasional Contributor III

Yes, Tim is right on with that GP tool. Try:

# Import arcpy
import arcpy

# Define the tool parameters
in_fc = r"[path_to_your_polygon_fc]"
out_fc = r"[path_to_point_fc]"

# Convert the feature vertices to points
arcpy.FeatureVerticesToPoints_management(in_fc, out_fc)

# Count the features and print the answer
print(int(arcpy.GetCount_management(out_fc).getOutput(0)))

I hope it works for you!

Warm Regards,

Micah Babinski

0 Kudos
PROBERT68
Frequent Contributor

Is that for shapefiles only ? What about geodatabases ?

0 Kudos
PROBERT68
Frequent Contributor

Never mind. I got it to work.

0 Kudos