ArcPy: Why isn't the distance argument in densify() optional?

484
1
02-04-2022 08:39 PM
Bud
by
Notable Contributor

I have an ArcPy script that densifies polylines — to preserve any true curves that were in the features:
(the curves become densified straight segments)

with arcpy.da.UpdateCursor(fc, 'SHAPE') as cursor:
    for row in cursor:
        feature = row[0].densify ("ANGLE", 10000, 0.174533) #0.174533=radians

Bud_0-1644034325305.png

Details:

I don't want to densify straight segments, since that's not necessary here. I only want to densify the curved segments.

So, in the densify function, I only really care about the TYPE and DEVIATION arguments. I don't need the DISTANCE argument, since all it seems to accomplish is adding vertices to straight segments (not what I want).

densify (type, distance, {deviation})
densify ("ANGLE", 10000, 0.174533) #0.174533=radians

With that said, I've noticed that the DISTANCE argument is mandatory. So I work around it by putting a dummy value of 10,000 meters in it, since there would never be a segment that big in my data. (I tried setting it to None but I got an error.)

Question:

Is there a reason why is the DISTANCE argument a required argument? Why can't it be optional, since for cases like mine, I don't want to specify it?  
Have I misunderstood something?

Thanks.

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

Have you looked tools designed for densification purposes rather than using a cursor? For example

Densify (Editing)—ArcGIS Pro | Documentation

And if you get the circular arcs densified but you want to generalize the straight sections, you can keep the segmented arcs and remove extraneous points on the straight segment

Simplify By Straight Lines And Circular Arcs (Editing)—ArcGIS Pro | Documentation

There are other built in tools as well that extend beyond what is available in plain arcpy and cursors

 


... sort of retired...