Select to view content in your preferred language

create offset polyline in arcpy

4255
2
Jump to solution
05-17-2012 09:28 AM
JamieKass
Regular Contributor
I am trying to create an offset polyline using arcpy, identical to the function in ArcObjects (constructoffset). After trying to access ArcObjects in arcpy, which I found difficult for those not well-versed in COM languages, and after much searching, I discovered that this functionality seems to only exist in ArcObjects. There may be ways to program this functionality in arcpy using trig, but that would take me hours. Essentially, the product I'd like is an offset polyline that preserves all original geometry and curvature. Have any other arcpy users needed this functionality, and is there something in the works at ESRI to make ArcObjects more easily accessible in arcpy?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JamieKass
Regular Contributor
Well, if anyone still wants to do this in arcpy, we figured it out:

First off, make sure your line segs have unique IDs.

    1.Buffer "FLAT" in each direction of the line, add a new field of the same name to each and give them a direction ("L","R").
    2.Merge the buffers together.
    3.Buffer the original line again, this time "FULL".
    4.Convert the FULL buffer to lines (PolygonToLine: "IGNORE_NEIGHBORS"), then convert its vertices to points (FeatureVerticesToPoints: "BOTH_ENDS").
    5.Buffer each point by a very small width (e.g. 0.1 m).
    6.Split the lines by vertex (SplitLine).
    7.Select by location to select all lines that intersect with the point buffers.
    8.Delete these lines.
    9.Dissolve ("SINGLE_PART") on the segment unique ID.
    10.Spatial Join ("SHARE_A_LINE_SEGMENT_WITH") the new lines to the merged "LEFT" and "RIGHT" buffers to attribute them with direction.

Voila! Offset lines without ArcObjects.

View solution in original post

0 Kudos
2 Replies
JamieKass
Regular Contributor
Well, if anyone still wants to do this in arcpy, we figured it out:

First off, make sure your line segs have unique IDs.

    1.Buffer "FLAT" in each direction of the line, add a new field of the same name to each and give them a direction ("L","R").
    2.Merge the buffers together.
    3.Buffer the original line again, this time "FULL".
    4.Convert the FULL buffer to lines (PolygonToLine: "IGNORE_NEIGHBORS"), then convert its vertices to points (FeatureVerticesToPoints: "BOTH_ENDS").
    5.Buffer each point by a very small width (e.g. 0.1 m).
    6.Split the lines by vertex (SplitLine).
    7.Select by location to select all lines that intersect with the point buffers.
    8.Delete these lines.
    9.Dissolve ("SINGLE_PART") on the segment unique ID.
    10.Spatial Join ("SHARE_A_LINE_SEGMENT_WITH") the new lines to the merged "LEFT" and "RIGHT" buffers to attribute them with direction.

Voila! Offset lines without ArcObjects.
0 Kudos
FabianBlau
Deactivated User
There is a way to use ArcObjects in Python (without arcpy):
http://www.pierssen.com/arcgis/upload/misc/python_arcobjects.pdf
0 Kudos