I am a not so newbie user of QGIS but have no knowledge of Python.

I have a large dataset of points. Each point has attributes, one of which is a group it belongs to. It is expected that the points in each group form a compact form. But from initial analysis I've found that some groups have points very far away from the main "point cloud".

I'm trying to find a way to flag these outlier points to later delete or disconsider them from my analysis. I do have a theoretical approach but don't know if there is some plugin or script that i could use.

My reasoning goes like this. If for each group I calculate the sum of distances of each point to every other point in the group the outliers will have a much greater sum than an average point in the "point cloud". I can then use some measure of standard deviation to set my threshold level to flag points as outliers.

Question is. How do I make this sum? Considering I have a dataset of millions of points and thousands of groups?

  • similar question: gis.stackexchange.com/questions/254166/…
    – csk
    Feb 6, 2019 at 21:19
  • Are the point clouds all expected to be about the same size? If so, you could use the "minimum bounding geometry" tool to create convex hulls for the groups, and only work on groups whose convex hull is much larger than the expected size.
    – csk
    Feb 6, 2019 at 21:22
  • Not really. Size and shape may vary, and the clouds (points from 2 different groups) might actually overlap.
    – Jan Kruger
    Feb 7, 2019 at 13:52

2 Answers 2


This is actually a data science question vs. one directly related to GIS. And it's a concept that is way more complicated than it initially seems. If you're interested in ways of categorizing/grouping that data, you'll want to take a look at data clustering (2) and machine learning. The stats section of Stack Exchange would be a good resource to start with.


I did this with python, pandas, and sklearn:

import pandas as pd
from sklearn.ensemble import IsolationForest

df = pd.read_csv("points.csv")
df["outlier"] = IsolationForest().fit_predict(df[["latitude", "longitude"]])
cleaned_df = df[df["outlier"] != -1]

Your Answer

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

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