New paste Repaste Download
#!/usr/bin/env python3
import csv
import os
input_file = "/storage/emulated/0/wifi_gps_log.csv"
ap_data = {}
# Read CSV
with open(input_file, "r") as f:
    reader = csv.DictReader(f)
    for row in reader:
        bssid = row["BSSID"]
        try:
            lat = float(row["Latitude"]) if row["Latitude"] else None
            lon = float(row["Longitude"]) if row["Longitude"] else None
            rssi = float(row["RSSI"]) if row["RSSI"] else 0
            ssid = row["SSID"]
        except ValueError:
            continue
        if lat and lon:
            if bssid not in ap_data:
                ap_data[bssid] = {"coords": [], "rssi": [], "ssid": ssid}
            ap_data[bssid]["coords"].append([lat, lon])
            ap_data[bssid]["rssi"].append(rssi)
# Compute weighted averages and stats
for bssid, data in ap_data.items():
    coords = data["coords"]
    rssi = data["rssi"]
    ssid = data["ssid"]
    num_samples = len(rssi)
    if not rssi or sum(rssi) == 0 or num_samples == 0:
        continue
    weights = [r / sum(rssi) for r in rssi]
    ap_lat = sum(c[0] * w for c, w in zip(coords, weights))
    ap_lon = sum(c[1] * w for c, w in zip(coords, weights))
    min_rssi = min(rssi)
    max_rssi = max(rssi)
    print(f"AP {bssid} (SSID: {ssid}): Lat={ap_lat:.6f}, Lon={ap_lon:.6f}, Samples={num_samples}, Min_RSSI={min_rssi:.1f}, Max_RSSI={max_rssi:.1f}")
Filename: None. Size: 1kb. View raw, , hex, or download this file.

This paste expires on 2025-05-14 03:12:53.219170. Pasted through web.