8

I am using QGIS 2.18 . I have shapefile which contains multiple lines. After processing certain data processing , I need to draw parallel lines at different distances from existing lines. For example I have 32 lines in existing shapefile. I want to draw parallel lines at distance of 50, 100, 170, 500,400 from line ID no. 3 ,6,20,25,31 in one go. Is there any method or plugin in QGIS for doing same?

5

You may use the QAD plugin, which offers CAD-like commands in QGIS.

It only works with Projected Coordinate Systems (so you need to project your data before using it) and with editing mode enabled (right-click on the layer and select Toggle Editing).

For your case, you need to click on the Offset button:

enter image description here

and follow the instructions that will appear on the QAD text window (exactly as in AutoCAD):

enter image description here

For example, this is the output when using a different offset for two different features:

enter image description here

  • Thanks for your reply. Is there any other method or plugin to do this task without projecting data? – Jitendra Feb 27 '17 at 8:35
  • I used an approach with projected data since it seemed you were dealing with meters (distances of 50, 100, 170, 500,400..). Changing projection is very simple: right-click on the layer, then Save as and finally select a Projected Coordinate System. Once you have performed the offset, you may turn back to the Geographic Coordinate System with the reverse operation... It should be correct. – mgri Feb 27 '17 at 9:20
  • Without projecting the data, you need to deal with angles instead of meters and I don't know if it becomes easier for you... – mgri Feb 27 '17 at 9:22
  • The QAD tool is working fine. But I have to repeat task for all the lines in shapefile manually. Is there any method to read line_ID and distance to line read from attribute table or exel or CSV file automatically and draw all parallel lines simultaneously. – Jitendra Feb 27 '17 at 12:08
  • I don't know a tool which does this task, but I may try to give a solution using PyQGIS... Could it be of interest for you? – mgri Feb 27 '17 at 13:25
4

If you have a column in your attribute table which specifies the distance between the parallel lines then the following method should be able to do it in one go -

You can use the Single sided buffers (and offset lines) for lines algorithm under GDAL/OGR > [OGR] Geoprocessing in the Processing toolbox. You will need to set the Operation as Offset Curve and enter the name of the column containing the distance in Buffer distance (In my case the name of the column is width). Also you can set which side of the line the parallel line should be drawn by selecting Buffer side as right or left.

enter image description here

  • Thanks for reply. I am using OGR tool as per your suggestion but nothing has been shown in new output shapefile. – Jitendra Feb 28 '17 at 12:51
  • Can you share the projection system your shape file is in? Screenshots of the output layer attribute table maybe helpful. – nash Feb 28 '17 at 16:18
  • Projection system of shapefile is EPSG 4326 – Jitendra Feb 28 '17 at 16:44
  • So you do understand that the new lines are created at a distance of 50,100,170,500 and 400 which is in the unit Degrees and not meters(which I am assuming you want?) – nash Feb 28 '17 at 16:47
  • Assuming that you want the distance in meters - you'd have to convert your shapefile in a projection system with units in meters (for example a UTM projection system of the applicable zone). Then run the algorithm. – nash Feb 28 '17 at 16:52
4

You may use "v.parallel", you can found this tool in QGIS processing toolbox.

  1. Select the line with line ID no. 3 ,6,20,25,31 Select lines

  2. Use "v.parallel", create parallel line from the selected lines. But, you have to do multiple times to produce different offset distances (50, 100, 170, 500,400). There is a option "Side", you can assigns the location of the parallel lines. "v.parallel"

  3. Result: parallel lines (blue colored) at left side of the selected lines result
  • Thanks Cy Y for reply. I have used v.parallel command but nothing has been shown in new output shapefile. – Jitendra Feb 28 '17 at 13:49
  • 1
    p/s: "v.parallel" command only work with curved lines, it can't work to the straight lines which have only two line vertex. – Cy T Mar 1 '17 at 1:12

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.