[GIS] Getting all the points of polyline

arcpyfeaturesgeometry-conversionpointvertices

I have some polyline feature objects in Python. Now I want to get all the points of polylines.

For example, if a polyline has start point [0,0] end point [5,5].
Result: [1,1];[2,2];[3,3];[4,4];[5,5].

I want to find all the integer points on that line including end points. For straight line this is dead simple, but if polyline has Beizer Curve, Circular Arc, Elliptic Arc geometry types, then how can I do it?

I can only use those tools which are available in all license levels of ArcGIS. For example, ArcGIS Basic.

Best Answer

I know this is old but I was looking for the same as I don't have ArcInfo for the FeatureVerticesToPoints tools. After using Search cursor solution above I went forward to simplify the code and found that using NumPy Arrays in the Data Access Module a simple and very quick script could be produced. I'm using this as a script tool.

Note: The key is the explode_to_points parameter in arcpy.da.FeatureClassToNumPyArray

Here is link to ArcGIS Repository Location: Feature Class to Points

# Feature Class to Points
# 
# Paul Smith (2012) paul@neoncs.com.au

# Imports
import arcpy
import numpy

#Inputs from user parameters
InFc  = arcpy.GetParameterAsText(0) # input feature class
OutFc = arcpy.GetParameterAsText(1) # output feature class

# Spatial reference of input feature class
SR = arcpy.Describe(InFc).spatialReference

# Create NumPy array from input feature class
array = arcpy.da.FeatureClassToNumPyArray(InFc,["SHAPE@XY"], spatial_reference=SR, explode_to_points=True)

# Check array and Exit if no features found
if array.size == 0:
    arcpy.AddError(InFc + " has no features.")

# Create a new points feature class
else:
    arcpy.da.NumPyArrayToFeatureClass(array, OutFc, ['SHAPE@XY'], SR)