Download analytics/geo_proof.sql from MoxieB/bsiq: direct link, hf CLI and curl.
- Browser
- Download file 984 Bytes
-
https://huggingface.co/spaces/MoxieB/bsiq/resolve/main/analytics/geo_proof.sql
- Command line
-
hf download hf://spaces/MoxieB/bsiq/analytics/geo_proof.sql
-
curl -L -o geo_proof.sql https://huggingface.co/spaces/MoxieB/bsiq/resolve/main/analytics/geo_proof.sql
984 Bytes
| -- BigQuery GIS proof: event point and optional distance from MAREA. | |
| -- Use after Bronze has rows: event point from usgs_raw, MAREA stub from data/marea_route.json | |
| -- or a single-row table. For Week 3, wrap in risk_proximity.sql with 200 km buffer. | |
| -- | |
| -- Note: BigQuery uses ST_GEOGFROMTEXT (WKT format), not ST_GEOGFROMGEOJSON. | |
| -- For GeoJSON files (e.g., data/marea_route.json), convert to WKT or use a Python | |
| -- library (e.g., shapely) to convert before BigQuery insert. | |
| -- Example: point from lat/lon | |
| -- SELECT ST_GEOGPOINT(lon, lat) AS geography FROM bronze.usgs_raw LIMIT 1; | |
| -- Example: distance (meters) from a test point to MAREA stub (Virginia Beach ≈ -75.98, 36.85) | |
| WITH marea_stub AS ( | |
| SELECT ST_GEOGFROMTEXT('LINESTRING(-75.98 36.85, -2.99 43.38)') AS route_geom | |
| ), | |
| test_point AS ( | |
| SELECT ST_GEOGPOINT(-76.0, 37.0) AS pt -- near Virginia Beach | |
| ) | |
| SELECT | |
| ST_DISTANCE(t.pt, m.route_geom) / 1000 AS distance_km | |
| FROM test_point t, marea_stub m; | |