I'm looking to create a new line shapefile to connect two sets of point files using a common reference field.

E.g. in the below image i'd have 7 lines connecting from the blue shapefile to the orange shapefile. I have a few hundred clusters of features like this so need a fairly automated way.

enter image description here

  • 1
    Can you give a bit more detail? Do you have pairs of shapefiles, one of which has one point, and the other has N points? And then you have a few hundreds of pairs of shapefiles? Or are you matching some attribute from one shapefile to all the points in another shapefile (in the map shown, TL25015606). Can you describe this all a bit better, with examples?
    – Spacedman
    Sep 5, 2017 at 9:33

1 Answer 1


There are a couple of options available to you:

  1. RT QSpider plugin that will create a spider diagram using pairs of coordinates. You'll need to create one table listing all the source coordinates with their target coordinates.

RT QSpider plugin

  1. Use PostGIS and a simple query to build the lines from the coordinate pairs held in your_table. The data could be in a single table or two tables joined on a common ID.

SELECT sourceid, targetid, ST_MakeLine(ST_MakePoint(source_x, source_y),ST_MakePoint(target_x, target_y)) FROM your_table;

spider diagram example

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.