Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I would like to make a buffer for a polyline and get as Output a Polygon with the same angles as the polyline, having not arcs, like in ordinary buffers.

i tried the FLAT option in arcpy, but it's applied to just the both ends.

enter image description here

share|improve this question
1  
Can you post the code that you are using? –  Taylor H. Feb 11 '13 at 15:25
1  
Even if you can do this you migh have an issue with the polylines crossing each other which is why it may be difficult to create a tool that can do this automatically without any manual input. I will post a link to a tool I created for a similar purpose. –  Jakub Feb 11 '13 at 16:06
add comment

2 Answers

You could try the Flat-end line buffer tool. I made it for a specific purpose for which it works fine. I sometimes merge the result to create a polygon from. The tool should work fine with 10.0. Have not tested in 10.1.

EDIT: There is a few parameters that can be set; distance, mitered or beveled, extend line ends. (for my purposes I needed to extend the line ends so i made that an option) Because it was made for specific purpose you should be aware that it does not resolve crossing lines (as I mentioned in my comment above). If anyone is interested I can illustrate what this looks like. Basically, resulting crossing lines have to be resolved manually before creating a polygon or polygon will result in a non-simple geometry.

I thought I would add some visuals to show what this basically does: enter image description here Result: enter image description here Result as polygon (also use a custom tool for that): enter image description here

share|improve this answer
    
Thanks a lot , but i can use this add-on from a python script ? –  geogeek Feb 11 '13 at 16:33
1  
Can't say. I only use geoprocessing tools (that can be converted to Python) to call from VB.NET but not the other way around. I will share the code including the VS project if someone wants to try. –  Jakub Feb 11 '13 at 18:03
1  
The 'guts' of the script use the IConstructCurve:ConstructOffset method. –  Jakub Feb 11 '13 at 18:40
    
thanks a lot __ –  geogeek Feb 11 '13 at 20:47
add comment
up vote 2 down vote accepted

I have made a function in ArcPy to offset a polyline. Here's the function from my ArcPy script and the result:

enter image description here

def offset(layer_in , layer_out , distance ):
    arcpy.Select_analysis(layer_in , "line_offset")
    arcpy.SplitLine_management("line_offset", "line_offset_split")
    arcpy.Buffer_analysis("line_offset_split", "line_offset_split_buf", distance  ,"FULL","FLAT","NONE")
    arcpy.FeatureVerticesToPoints_management("line_offset","line_offset_points", "ALL")
    arcpy.AddField_management("line_offset_points" , "X" , "DOUBLE" )
    arcpy.AddField_management("line_offset_points" , "Y" , "DOUBLE" )
    arcpy.CalculateField_management("line_offset_points", "X" , "!Shape.lastpoint.X!","PYTHON_9.3")
    arcpy.CalculateField_management("line_offset_points", "Y" , "!Shape.lastpoint.Y!","PYTHON_9.3")
    arcpy.Intersect_analysis(["line_offset_split_buf" ], "line_offset_split_buf_intersect" , "")
    arcpy.SpatialJoin_analysis("line_offset_split_buf_intersect"  , "line_offset_points" , "line_offset_split_buf_intersect_sj","JOIN_ONE_TO_ONE" , "KEEP_COMMON" , "" , "INTERSECT")##
    rows = arcpy.UpdateCursor("line_offset_split_buf_intersect_sj")
    for row in rows :
        x = row.getValue("X")
        y = row.getValue("Y")
        polyOuter = arcpy.Array()
        feat = row.Shape
        part = feat.getPart(0)
        for pt in iter(lambda:part.next(),None) : # iter stops on null pt
            polyOuter.append(arcpy.Point( 2*x - pt.X ,2*y - pt.Y) )
        row.setValue("Shape"  , arcpy.Polygon(polyOuter))
        rows.updateRow (row)

    arcpy.Append_management("line_offset_split_buf_intersect_sj","line_offset_split_buf","NO_TEST")
    arcpy.Dissolve_management("line_offset_split_buf", "line_offset_split_buf_disolv", "ID" , "", "SINGLE_PART")## the field is set to not dissolve all polygons
    arcpy.Generalize_edit("line_offset_split_buf_disolv", "0.001")
    arcpy.Select_analysis("line_offset_split_buf_disolv" , layer_out)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.