6

I have a table of stream reaches with XY coordinates for their respective tops and bottoms.

I'd like to convert the table to a feature, using the XY coordinates as the endpoints of the line.

Any suggestions as to the best workflow for doing this would be fantastic. I've Googled, but either my vocabulary is off or this isn't a task that's given others much trouble.

4 Answers 4

6

The Points2One Plugin might be helpful here. Your data will have to be in the following format:

id,      order, x,       y
stream1, 1,     x_start, y_start
stream1, 2,     x_end,   y_end
stream2, 1,     x_start, y_start
stream2, 2,     x_end,   y_end

After loading a file like this, you should get four points displayed. In Points2One Plugin, you can chose that points should be connected to lines grouped by the "id" value and sorted by the "order" value.

3
  • Perfect. Checking it out now. Oct 19, 2011 at 13:03
  • Where is it that you can get hold of or install the points to one plug in?
    – user6607
    Mar 29, 2012 at 11:00
  • @sam Plugins menu - Fetch Python Plugins. Search for Points2One.
    – underdark
    Mar 29, 2012 at 11:22
6

If you have coordinates of two points, representing start- and endpoint, you can also use "geometry by expression" from processing toolbox in QGIS 3.

Use this expression:

make_line(make_point("x_start","y_start"),make_point("x_end","y_end"))

Where x_start is the field containing x-coordinate of your startpoint, y_start the y coordinate, and so on...

enter image description here

2

In QGIS, try the "Points2One" plugin, and set the output geometry to lines. It requires the features you wish to be grouped together to have the same IDs.

EDIT: I see you have the data in a table. You would need to first import the table to a point shapefile (using the Delimited Text plugin). Then use the shapefile in the Points2One plugin.

Kosmo GIS also has a tool for this - "Get Lines From Points".

0
2

With QGIS >3.0 (where Points2One is not avilable) you can do this without any plugin, using Toolbox > Points to path.

Your Answer

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

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