1

How can I generate a line with given center point, angle and length in QGIS?

I am analyzing that auto extraction lineament for geologic structure analyze.

2
  • 2
    y=mx+c should be all you need
    – Ian Turton
    Commented Nov 8, 2021 at 8:47
  • Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works
    – Ian Turton
    Commented Nov 8, 2021 at 8:47

1 Answer 1

4

Creating a line without PyQGIS, using only QGIS expressions: Use either Geometry generator (for visualization only) or create actual geomtries with Geometry by expression - use this one to create actual geometries (real lines): see here for details).

If the point should be in the middle of the line, simply extend the line. Use this expression for a line with length of 20 and angle (azimuth: angle clockwise from north) of 112° degrees:

extend (
    make_line(
        $geometry,
        project(
            $geometry,
            20,
            radians(112)
        )
    ),
    20,
    0
)

enter image description here

1
  • Thanks for your reply. What I really want to know is create real lines (features). The method you taught me is just styling. And the position of the line is the center point of the point. Again, please answer my question.
    – kang6gab
    Commented Nov 9, 2021 at 9:38

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.