[GIS] Creating polyline buffer with ArcPy

arcpybuffer

I'm trying to write a python script with ArcPy that draws arcs and I've achieved something with creating a buffer and then clipping it with a bounding box so I only keep the length I need (I thought it was easier that way than calculating from my center point and radius, vertex by vertex from my start angle to my end angle). The problem is that the buffer too creates polygon buffers and since I only have ArcVIew (soon ArcEditor) and I can't use the polygon to line tool (licenced to ArcInfo).

Is there a way to convert a polygon to a polyline somehow with ArcPy or create directly a polyline buffer?

Best Answer

You could go about this in a few ways. One way to do it without Zero_Qualms' suggestion of ET_GeoWizards and with only an ArcView licence is to create your buffer polygons just as you have done. Then iterate over the buffer polygons, pulling out their geometry and build a new feature class using the geometry but cast it as a polyline instead. See these sections of the documentation to help you (if needed) with reading and writing geometries in ArcPy (scroll down for examples).

The alternative is to write a script to create the line without creating a buffer to copy first. You will need to read the geometries of your lines and progress from point to point, calculating the bearing at each step and then calculating the offset location of your buffer-line. This should be straightforward with a bit of basic vector maths and trig. You can calculate bother the left and right side of the line at the same time. You just need to ensure that the right-side (assuming a clockwise winding) points are added to your polyline so they are in sequential order following the entire set of left-hand points and in the reverse direction. You could do this by having two lists of points and then reverse the order of your right-hand point list before appending it to the lefthand points list to make your line.

Related Question