I need to create a batch of paths so that I can calculate the best potential placement of a development site by counting the number of intersecting features along that path.

I have a grid of points in one layer and a single point in another. I would like to create a line for each of the features in the start layer to the single point in the other layer.

Most of points to line features only take one layer as an input or either take two layers with a single feature.

QGIS on MacOS El Cap

Is there a possible solution to this?

  • QGIS on MacOS El Cap. – Chris Page Mar 1 '19 at 14:41

In QGIS you can make use of the virtual layers.

Go to Layer/ Add layer/ add-edit virtual layer and enter the following query. Replace source and destination by the real layer name.

select a.id, makeline(a.geometry, b.geometry)
from source a, destination b

enter image description here

| improve this answer | |
  • This looks very helpful - although I get an error saying no column with ID, tried changing it to other column names but no avail – Chris Page Mar 1 '19 at 14:34
  • @ChrisPage yes, you can use any field name from the input layers. In the answer, the field is named id and belongs to the source layer. Notice I gave an alias a and b to the layers, and so I can use these aliases in the select – JGH Mar 1 '19 at 15:30

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.