Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some lines. I want to draw perpendicular lines at the start and end of the lines, on both sides of the lines.

Can somebody help me in Python? Also, what are the variable settings of the script?

I am using ArcGIS.

share|improve this question
What software.? – Nathan W Jan 22 '13 at 12:20
Python, ArcGis, – Marjo van Balen Jan 22 '13 at 12:27

I have done something like this with arcObjects.

void DrawNormalOnPolyline(IPolyline polyline)
    IActiveView activeView = ArcMap.Document.ActiveView;
    double length = polyline.Length;
    ILine normalLine;
    normalLine = GetNormalOnPolylineFromStartPointToSpecificDistance(polyline, 0);//perpendicular line at start
    normalLine = GetNormalOnPolylineFromStartPointToSpecificDistance(polyline, length);//perpendicular line at end
    activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

ILine GetNormalOnPolylineFromStartPointToSpecificDistance(IPolyline polyline, double distance)
    double normalLineLength = 0.01;
    ILine normal = new Line();
    ICurve curve = polyline;
    curve.QueryNormal(esriSegmentExtension.esriNoExtension, distance, false, normalLineLength, normal);
    return normal;

void DrawLine (ILine normalLine)
    IElement element = null;
    IGraphicsContainer graphicsContainer = (IGraphicsContainer)ArcMap.Document.FocusMap;

    ILineElement lineElement = new LineElementClass();
    lineElement.Symbol = GetLineStyle();
    element = (IElement)lineElement; 

    if (!(element == null))
        element.Geometry = GetLineGeometry(normalLine);
        graphicsContainer.AddElement(element, 0);
share|improve this answer

Here is a Python toolbox to create an assortment of perpendicular lines at various places along the line including starts and end points...

share|improve this answer
Also see Perpendicular Transects ArcGIS 10 toolbox by Mateus Ferreira. It's also for creating perpendicular at regular intervals along the line instead of just at ends, but has an option for deriving the split distance from a field name. Perhaps if the Length field was used it would only do end points. – matt wilkie Jun 16 '15 at 19:08
GBG we generally discourage link-only answers. Inevitably they succumb to link-rot and then the "answer" doesn't apply any more. If you can, include something that will allow a future searcher to (re)build their own solution when the destination link has disappeared. – matt wilkie Jun 16 '15 at 19:09

Your Answer


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.