I have a problem to rotate a point (valve symbol) on a polyline I used the code below and it works with me but when I put point on line only and did not work with polyline

 public double pointAngle(IPoint aPoint, IFeature LineFeature)
        IPolyline pPolyline = LineFeature.Shape as IPolyline;
        IPoint pFromPoint = pPolyline.FromPoint;
        IPoint pToPoint = pPolyline.ToPoint;

        ILine pLine = new Line();
        pLine.PutCoords(pToPoint, pFromPoint);
        ILine pLine2 = new Line();
        pLine2.PutCoords(aPoint, pFromPoint);
        ILine pLine3 = new Line();
        pLine3.PutCoords(aPoint, pToPoint);
        double dAngle;
        if (pLine3.Length < pLine2.Length)
          //  dAngle = ((pLine3.Angle* 180)/pi); //Math.PI) ;
            dAngle = ((pLine3.Angle * 180) / Math.PI) ;
            dAngle = ((pLine2.Angle* 180)/ Math.PI) ;
        dAngle = dAngle + 90;
        return dAngle;


and when I used this code nothing happen with me because I think I use ITransform2D.rotate wrong

 IFeature feature = dssClass.SelectFeatureByID("Valve", 180);
        IPoint ppPoint = feature.Shape as IPoint;
        double radian = 1.5708;
        ITransform2D pTrans2D = ppPoint as ITransform2D;
        pTrans2D.Rotate(ppPoint, radian);

All I need like this picture

enter image description here

  • 2
    I suspect the Transform has worked you need to write the new geometry back to your dataset. As we are not seeing the whole code I can't tell if you are actually storing the feature?
    – Hornbydd
    Commented Jan 3, 2017 at 16:37

2 Answers 2


A point geometry has 0 dimension so rotating it will have no effect. As I understand from your question, you want to rotate the symbol - not the feature. The usual approach is to add an attribute to the feature class to store the symbol rotation value. Then apply that field using the Layer-> Properties-> Symbology dialog.

        ITransform2D pTrans2D = ppPoint as ITransform2D;
        pTrans2D.Rotate(otherPoint, radian);

otherPoint - The point relative to which will be the rotation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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