3

I need to create plugin to QGIS that will draw buffers about width equal 1/2 length each line.

Example (my amateur sketch in MS Paint): enter image description here

So, around each lines be created square

I searched good solution but I found only plugin Buffer by percentage (it works only with polygon) and a few threads about buffer around point but it's not enough for me.

Maybe you have an idea how it could be solved?

I don't need all code, I just don't know what I should do now.

  • What's wrong with calculating the length of your line and using a flat cap buffer of width of length/2 ? – J.R Sep 12 at 11:29
5

You can use the buffer geoprocessing tool.

Make sure not to enter a fixed distance, but instead to select an expression and to use half the geometry length (length($geometry)/2)

enter image description here

  • Ok, it works if I have a few lines, but I have one polyline. Maybe I should try to split this polyline to lines and later trying this method...and later changing all for code. Thanks very much – Robert Sep 12 at 12:27
  • Use processing. You can write simple schema witch input as line, line to segments algorithm and at the end buffer. – GSienko Sep 12 at 16:09
0

I think the provision is already there in QGIS.

https://docs.qgis.org/2.8/en/docs/gentle_gis_introduction/vector_spatial_analysis_buffers.html

  1. Go to Processing > Toolbox
  2. Search for Buffer

This should give you the expected result.

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • On this website don't have anything about percentage buffer. I don't have problem with create buffer about specific distance. I want add line layer as input layer (red line on my picture) and get polygon as output layer (area marked green lines) – Robert Sep 12 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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