Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shadowspore/t38c
Tile38 Client package
https://github.com/shadowspore/t38c
geo geofence geolocation geospatial golang-package spatial tile38
Last synced: 5 days ago
JSON representation
Tile38 Client package
- Host: GitHub
- URL: https://github.com/shadowspore/t38c
- Owner: shadowspore
- License: mit
- Archived: true
- Created: 2020-04-05T14:19:44.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-31T07:00:35.000Z (about 1 year ago)
- Last Synced: 2024-05-06T15:11:25.602Z (6 months ago)
- Topics: geo, geofence, geolocation, geospatial, golang-package, spatial, tile38
- Language: Go
- Homepage:
- Size: 292 KB
- Stars: 82
- Watchers: 1
- Forks: 31
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - shadowspore/t38c - Tile38 Client package (others)
README
# Tile38 Client for Go
[![Go](https://github.com/shadowspore/t38c/workflows/Go/badge.svg)](https://github.com/shadowspore/t38c/actions)
[![Documentation](https://pkg.go.dev/badge/github.com/shadowspore/t38c)](https://pkg.go.dev/github.com/shadowspore/t38c?tab=doc)
[![Go Report Card](https://goreportcard.com/badge/github.com/shadowspore/t38c)](https://goreportcard.com/report/github.com/shadowspore/t38c)
[![codecov](https://codecov.io/gh/shadowspore/t38c/branch/master/graph/badge.svg)](https://codecov.io/gh/shadowspore/t38c)
[![license](https://img.shields.io/github/license/shadowspore/t38c.svg)](https://github.com/shadowspore/t38c/blob/master/LICENSE)See what [Tile38](https://tile38.com/) is all about.
- [Supported features](TODO.md)
- [Examples](examples)## Installation
```
go get github.com/xjem/t38c@latest
```## Basic example
```go
package mainimport (
"fmt""github.com/xjem/t38c"
)func main() {
client, err := t38c.New(t38c.Config{
Address: "localhost:9851",
Debug: true, // print queries to stdout
})
if err != nil {
panic(err)
}
defer client.Close()if err := client.Keys.Set("fleet", "truck1").Point(33.5123, -112.2693).Do(context.TODO()); err != nil {
panic(err)
}if err := client.Keys.Set("fleet", "truck2").Point(33.4626, -112.1695).
Field("speed", 20). // optional
Expiration(20). // optional
Do(context.TODO()); err != nil {
panic(err)
}// search 6 kilometers around a point. returns one truck.
response, err := client.Search.Nearby("fleet", 33.462, -112.268, 6000).
Where("speed", 0, 100).
Match("truck*").
Format(t38c.FormatPoints).
Do(context.TODO())
if err != nil {
panic(err)
}// truck1 {33.5123 -112.2693}
fmt.Println(response.Points[0].ID, response.Points[0].Point)
}
```## License
Source code is available under the [MIT License](LICENSE).