如何汇总地理编码的数据集以减少热图的数量?

I have a data set of Latitudes and Longitudes for populating a heat map. The data is too large and will keep on increasing day by day. I need to reduce the amount of data without much affecting the performance of the heat map. I understand we could add one more field for "weight" and combine two near-by points to form a new point with the "weight" as sum of the first two. But I am confused about where to plant the new point. I don't think this will be a standard way for solving my problem. I am using golang for the implementation, but all ideas are welcome. Thank you.

As mentioned by a commenter, consider using a weighted average of points, for example.

Pick some proximity threshold within which any points will be aggregated. For each of these points, generate a synthetic point whose coordinates are the average (median) of the others and whose weight is the count of the points in question. Include only the synthetic weighted points when generating your heatmap so that you can reduce the amount of data by adjusting your proximity threshold.

For example:

type Point struct{ X, Y float32 }

type WeightedPoint struct{ Weight, X, Y float32 }

func GetWeightedPoint(ps []Point) WeightedPoint {
    n := float32(len(ps))
    wp := WeightedPoint{Weight: n}
    if n > 0 {
        for _, p := range ps {
            wp.X += p.X
            wp.Y += p.Y
        }
        wp.X /= n
        wp.Y /= n
    }
    return wp
}

func main() {
    ps := []Point{{0.0, 0.0}, {1.0, 0.0}, {0.5, 1.0}}
    fmt.Printf("OK: %#v
", GetWeightedPoint(ps))
    // OK: main.WeightedPoint{Weight:3, X:0.5, Y:0.33333334}
}