1

I am still a beginner with GIS.

I can't find an easy way to get a maximum distance from multiple points.

I have a layer of up to 100 points (without a unique ID - maybe that is part of the problem? but I could easily add that) and I want to get the length of maximum distance between any two of them.

I tried plenty of line-points plugins, but nothing seems to work, I also tried to make a minimum convex polygon (basically convex hull of all the points) and get a diagonal of that but failed in all tries again.

How do I do this without using a programming language?

I am using QGIS 2.18.5

1
  • Vector, Analysis Tools, Distance Matrix will calculate the Distance between each Point. You can Sort the results to find the max distance.
    – klewis
    Apr 17, 2017 at 19:56

1 Answer 1

3

You will need an id of each record. Then a Spatialite self cross join SQL query of a virtual layer will give the distance between every point.

Adding an id column

In the Field Calculator:

enter image description here

Make a new integer column called id and update it with row_number:

enter image description here

Make a virtual layer:

enter image description here

Write the SQL:

select st_distance(t1.geometry, t2.geometry) as dist, t1.id as id1, t2.id as id2
from testpnt t1
cross join testpnt t2
order by 1 desc

Like:

enter image description here

Result:

enter image description here

Note:

This solution returns duplicated records (distance) for every two points, since id 1 is compared to id 2 and id 2 is also compared to id 1 in a cross join.

Update: The original table looks like this:

enter image description here

2
  • If I have to use the SQL, may you please show me a printscreen of your point layer so I can write it correctly? Sorry, as I said, don't know the language, so I can't modify it to make it work.
    – Marketa
    Apr 17, 2017 at 20:38
  • The only column you need in your point table is an id column. You can have all the columns you like, but one of them must be an id column. Updated the answer.
    – Jakob
    Apr 18, 2017 at 7:34

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.