You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add map view with Haversine distance function
- Implemented a new map view in ResultsPane to visualize geographic data.
- Added lazy loading for the MapView component to optimize performance.
- Introduced coordinate detection logic to identify latitude and longitude columns.
- Enhanced CellTable to support interaction between the map and grid views.
- Added HaversineFunction to calculate great-circle distances between coordinates.
- Created comprehensive tests for HaversineFunction covering various scenarios.
- Updated localization files to include new map-related strings.
- Modified third-party notices to include attributions for map services.
Copy file name to clipboardExpand all lines: docs/sql/spatial.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,17 +73,25 @@ SELECT point2d(latitude, longitude) FROM cities
73
73
|`point_z(p)`|`Float32`| Z component. **`Point3D` only** — `Point2D` has no Z. |
74
74
|`distance(a, b)`|`Float32`| Euclidean distance between two same-dimension points. |
75
75
|`distance_sq(a, b)`|`Float32`| Squared distance — skips the square root for KNN-ranking / threshold checks where absolute distance isn't needed. |
76
+
|`haversine(lat1, lon1, lat2, lon2)`|`Float64`| Great-circle distance in **meters** between two WGS-84 coordinates (decimal degrees — the shape geocoders produce). Spherical earth model matching PostGIS `ST_DistanceSphere`; null in any argument propagates. |
76
77
77
78
```sql
78
79
-- Find points within a radius
79
80
SELECT id, distance(pt, point3d(0, 0, 0)) AS r
80
81
FROM cloud
81
82
WHERE distance_sq(pt, point3d(0, 0, 0)) <100.0
82
83
ORDER BY r
84
+
85
+
-- Geographic: companies within 10 miles (16,093 m) of a point
86
+
SELECT name, haversine(lat, lon, 39.9612, -82.9988) /1609.34AS miles
87
+
FROM company_geo
88
+
WHERE haversine(lat, lon, 39.9612, -82.9988) <16093.4
89
+
ORDER BY miles
83
90
```
84
91
85
92
Mixing `Point2D` with `Point3D` in `distance` / `distance_sq` is a
86
-
function-argument error.
93
+
function-argument error. `haversine` is for geographic degrees; use
94
+
`distance` for planar/projected coordinates.
87
95
88
96
Both kinds also participate in `typeof()`, `IS Type`, and `CAST` like
89
97
any other DataKind. Field access via `.x` / `.y` / `.z` is sugar for the
0 commit comments