[GIS] How to average point features spatially in QGIS

pointqgis

I have a GPX file with track points and I want to average the points spatially to improve accuracy of the point feature. I can't just make a polygon and find its centroid as the number of overlapping points in a certain location should "weight" the result more than another location with few points. ie. if the field data collector was standing in one spot for 2 minutes I should have the bulk of points 'drifting' around the likely location of the point, and have scattered outliers around that, by averaging spatially based on all the points the outliers would be discounted in favour of the clustered points in the averaging.

Do I have to make a raster grid with small resolution and overlay it on my points and then count the points in each cell, or is there an easier geoprocessing kind of function to simply tell me the center coordinates (or make a new point) for the average center?

Best Answer

  1. Open the Processing Toolbox window pane: Processing menu -> Toolbox
  2. At the bottom of the window pane, enable Advanced interface
  3. From the Processing Toolbox -> QGIS Algorithms -> Vector analysis tools -> Mean coordinate(s).

Edit to discount outliers: Here is one way to discount outliers using inverse distance weighting. In this approach, points that have a small, average distance to other points will have a higher weight, and more influence on the mean point's location.

  1. Create a distance matrix with summary stats that describe the point separations:

    • Processing Toolbox -> QGIS Algorithms -> Vector analysis tools -> Distance matrix
    • Under type: Summary distance matrix
    • Pick the number of points you think should be considered. A larger number up to the number of points you have will be more accurate, but it will take longer to compute.
  2. Join the distance matrix to your points layer:

    • Right click on your vector layer in the layers window pane
    • Go to properties
    • Along the left hand side, choose Joins
    • Hit the green plus sign at the bottom to add a table
    • The join layer is the distance matrix
    • Join field and target field should be a unique identifier, e.g., row number
  3. Once they are joined, calculate inverse distance. This will be used to weight the mean point:

    • Open the attribute table of the points layer
    • Click on open field calculator
    • Output field name: inv_dist (or whatever)
    • Output field type: Decimal number (real)
    • Expression: 1 / "Distance matrix_MEAN"
    • hit ok to calculate
  4. Run mean coordinates with inverse mean distance as the weighting field:

    • Processing Toolbox -> QGIS Algorithms -> Vector analysis tools -> Mean coordinate(s)
    • Input layer is your original point vector layer
    • Weight Field is inv_dist
    • hit ok

The result will be a mean location in which the points that are on average far away from other points will have been discounted.

Related Question