https://github.com/iwpnd/detectr
minimal geofencing application
https://github.com/iwpnd/detectr
geofence-api geofencing gofiber rtree tile38
Last synced: 7 months ago
JSON representation
minimal geofencing application
- Host: GitHub
- URL: https://github.com/iwpnd/detectr
- Owner: iwpnd
- Created: 2021-10-09T14:09:30.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-12T18:45:02.000Z (11 months ago)
- Last Synced: 2025-03-15T15:39:39.055Z (7 months ago)
- Topics: geofence-api, geofencing, gofiber, rtree, tile38
- Language: Go
- Homepage:
- Size: 2.85 MB
- Stars: 16
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# detectr
A minimal geofencing application build with [gofiber](https://github.com/gofiber/fiber), using an embedded
[rtree](https://github.com/tidwall/rtree) and [geoindex](https://github.com/tidwall/geoindex) for fast
geospatial lookups.Bring your own data, pass a location and receive the geofences that your location
is currently in.## Installation
### cli
```bash
go install github.com/iwpnd/detectr/cmd/detectr-server@latest
``````bash
➜ detectr --help
NAME:
detectr - geofence applicationUSAGE:
detectr [global options] command [command options] [arguments...]COMMANDS:
help, h Shows a list of commands or help for one commandGLOBAL OPTIONS:
--port value define port (default: 3000)
--require-key use keyauth (default: false)
--log-level value set loglevel (default: "error")
--data value path to dataset to load with app
--help, -h show help (default: false)
```## Usage
```bash
# start updetectr --data my_featurecollection.geojson
``````bash
# send a locationcurl -X POST -H "Content-Type: application/json" -d '{"lng":13.4042367,"lat":52.473091}' http://localhost:3000/location
>> {
"data": {
"elapsed": "150.75µs",
"request": {
"lat": 52.473091,
"lng": 13.4042367
},
"matches": [
{
"type": "Feature",
"properties": {"id":"my geofence"},
"geometry": {
"coordinates": [
[
[
13.41493887975497,
52.47961028115867
],
[
13.393534522441712,
52.47961028115867
],
[
13.393534522441712,
52.466572160399664
],
[
13.41493887975497,
52.466572160399664
],
[
13.41493887975497,
52.47961028115867
]
]
],
"type": "Polygon"
}
}
]
}
}
```## License
MIT
## Acknowledgement
- Triggered by this article on the UBER engineering blog
about [UBERs highest query per second service](https://www.uber.com/en-DE/blog/go-geofence-highest-query-per-second-service/).
- Heavily inspired by [Tile38](https://github.com/tidwall/tile38) and build because
I wanted to understand how Tile38 works under the hood.## Maintainer
Benjamin Ramser - [@iwpnd](https://github.com/iwpnd)
Project Link: [https://github.com/iwpnd/detectr](https://github.com/iwpnd/detectr)