Marketplace
<div align="center"> <h3>Premium sponsors</h3> <p> <a href="https://id8media.com"><strong>ID8 Media</strong></a> · <a href="https://one-studio.co"><strong>One Studio</strong></a> </p> <p><sub>Support togo — <a href="https://github.com/sponsors/fadymondy">become a sponsor</a>.</sub></p> </div>
geo
Othertogo geo — distances, bounding boxes, nearest & geofencing
togo-framework
bash
togo install togo-framework/geoInstall
bash
togo install togo-framework/geoPure-Go geospatial helpers (GeoDjango-lite): great-circle distances, bearings, bounding boxes, polygon/circle geofencing, and nearest/within proximity queries — no external dependencies.
Usage
go
nyc := geo.Point{Lat: 40.7128, Lng: -74.0060}
la := geo.Point{Lat: 34.0522, Lng: -118.2437}
geo.DistanceKm(nyc, la) // ≈ 3935 km
geo.Haversine(nyc, la) // meters
geo.Bearing(nyc, la) // initial compass bearing (0–360°)
// Geofencing
fence := geo.Circle{Center: nyc, RadiusM: 5000}
fence.Contains(p) // within 5 km of NYC?
poly := geo.Polygon{{0,0},{0,1},{1,1},{1,0}}
poly.Contains(geo.Point{0.5, 0.5}) // point-in-polygon (ray casting)
// Proximity
geo.Nearest(nyc, points, 5) // 5 closest points, nearest first
geo.Within(nyc, points, 1000) // points within 1 km
// Bounding box (cheap pre-filter before exact distance)
box := geo.BoundsAround(nyc, 1000)
box.Contains(p)
Place index
go
ix := geo.NewIndex()
ix.Add(geo.Place{ID: "store-1", Point: nyc, Meta: map[string]any{"name": "HQ"}})
hits := ix.Near(me, 2000) // []PlaceHit sorted by distance, within 2 km
top := ix.Nearest(me, 10) // 10 closest
Point marshals as {"lat":…,"lng":…}; geo.Parse("40.7128,-74.0060") reads "lat,lng".
<div align="center"> <h3>Premium sponsors</h3> <p> <a href="https://id8media.com"><strong>ID8 Media</strong></a> · <a href="https://one-studio.co"><strong>One Studio</strong></a> </p> <p><sub>Support togo — <a href="https://github.com/sponsors/fadymondy">become a sponsor</a>.</sub></p> </div>