Skip to content
Skills Library
Programming · Building & coding

tile38

/tile38

Use the tile38.go Go client (github.com/GO-VIRTUAL-bv/tile38.go) to talk to a Tile38 geospatial database — connect, SET/GET objects, run NEARBY/WITHIN/INTERSECTS/SCAN searches, and stream live geofences, channels, and hooks. Trigger when writing Go that stores or queries geospatial points, needs geofence/proximity events, or when the user mentions Tile38, geofence, NEARBY/WITHIN/INTERSECTS, or this client.

Repository
tile38.go ↗
Licence
MPL-2.0
Last repository change
12.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 12.10.2026, without references to retired models or APIs.

Licence

MPL-2.0, otwarta.

What it does and when to use it

Use the tile38.go Go client (github.com/GO-VIRTUAL-bv/tile38.go) to talk to a Tile38 geospatial database — connect, SET/GET objects, run NEARBY/WITHIN/INTERSECTS/SCAN searches, and stream live geofences, channels, and hooks. Trigger when writing Go that stores or queries geospatial points, needs geofence/proximity events, or when the user mentions Tile38, geofence, NEARBY/WITHIN/INTERSECTS, or this client.

Original author description

Use the tile38.go Go client (github.com/GO-VIRTUAL-bv/tile38.go) to talk to a Tile38 geospatial database — connect, SET/GET objects, run NEARBY/WITHIN/INTERSECTS/SCAN searches, and stream live geofences, channels, and hooks. Trigger when writing Go that stores or queries geospatial points, needs geofence/proximity events, or when the user mentions Tile38, geofence, NEARBY/WITHIN/INTERSECTS, or this client.

How it works

  1. Install
  2. Connect
  3. Core rule: chain, then call the terminal
  4. Searches
  5. Live geofences
  6. Everything else
Original SKILL.md headings · 169 lines, 877 words
SKILL.md preview
---
name: tile38
description: Use the tile38.go Go client (github.com/GO-VIRTUAL-bv/tile38.go) to talk to a Tile38 geospatial database — connect, SET/GET objects, run NEARBY/WITHIN/INTERSECTS/SCAN searches, and stream live geofences, channels, and hooks. Trigger when writing Go that stores or queries geospatial points, needs geofence/proximity events, or when the user mentions Tile38, geofence, NEARBY/WITHIN/INTERSECTS, or this client.
---

# tile38.go

A dependency-free Go client for [Tile38](https://tile38.com). It speaks RESP over
`net.Conn` directly, so **live geofences** (a connection that streams events) are
first-class — something a Redis-library client cannot do.

This file is the fast path: the shape of the API and the one gotcha that bites
first. The catalog lives in the doc comments — see **Everything else** below.

## Install

```bash
go get github.com/GO-VIRTUAL-bv/tile38.go
```

Import path ends in `.go`; package is named `tile38`. Requires Go 1.25+.

```go
import "github.com/GO-VIRTUAL-bv/tile38.go"
```

## Connect

```go
c := tile38.New("localhost:9851", tile38.WithTimeout(2*time.Second))
defer c.Close()
if err := c.Ping(ctx); err != nil { return err }
```

Options: `WithPassword`, `WithMaxIdle`, `WithMaxActive`, `WithDialTimeout`,
`WithTimeout` — each doc comment states its default. `Client` is safe for
concurrent use; nothing connects until the first command.

## Core rule: chain, then call the terminal

Every command is a builder. Chain the parts **in any order** — they assemble into
protocol order at exec time. The terminal method is the one taking a `context`.

```go
// Write a point with a field and a 60s TTL.
err := c.Set("fleet", "truck1").EX(60).Field("speed", 42).Point(33.5, -115.5).Do(ctx)

// Read it back.
lat, lon, err := c.Get("fleet", "truck1").Point(ctx)
```

Method names mirror Tile38 keywords in Go casing (`Point`, `EX`, `Where`).

## Searches

Verbs `Nearby`, `Within`, `Intersects`, `Scan`. A search ends in `Do(ctx)`, and
an output format — `IDs`, `Points`, `Objects`, `Rects`, `Hashes`, `A5Cells` —
decides what `Do` returns; omit it for IDs. `Count(ctx)` and `Fence(ctx)` are
terminals instead, ending a chain in place of `Do`. Areas `Bounds`, `Circle`, `Object`, `Get`, `Tile`, `A5` (`Nearby`
uses `Point().Radius()`). Filters `Where`/`WhereIn`/`Match` accumulate;
`Limit`/`Cursor`/`Sparse`/`NoFields`/`Clip` overwrite.

```go
ids, err := c.Nearby("fleet").Where("speed > 40").Point(33.5, -115.5).Radius(5000).Do(ctx)
pts, err := c.Nearby("fleet").Point(33.5, -115.5).Radius(5000).Points().Do(ctx)
n, err   := c.Within("fleet").Bounds(33, -116, 34, -115).Count(ctx)
```

### The 100-result cap — the #1 gotcha

**Tile38 caps every search except `Count` at 100 results when no `Limit` is set.**
`Do` is one round trip and one page: a capped page comes back with a nil error,
so a query that is complete against a small collection quietly returns a prefix
once that collection grows.

Range `Iter(ctx)` instead of calling `Do` to take everything — it pages itself
and yields one result at a time:

```go
for id, err := range c.Scan("fleet").Iter(ctx) {
	if err != nil {
		return err
	}
	use(id)
}
```

Otherwise set an explicit `Limit` (or `Cursor`), which also bounds `Iter` to that
one page, or page by hand with `Cursor`/`NextCursor`:

```go
scan := c.Scan("fleet")
ids, err := scan.Do(ctx)
if scan.NextCursor() != 0 {
    // ids holds the first 100; more match.
}
```

### Errors

A `-ERR` reply is a `tile38.ServerError`: the command was rejected, the
connection is fine. Two sentinels cover a miss, matched with `errors.Is` through
every wrap: `ErrKeyNotFound` and `ErrIDNotFound`.

**Over RESP most misses are a null reply, not an error.** `GET`, `JGET` and
`BOUNDS` null out; only `FGET`, `FSET` and `RENAME` answer `-ERR`; `TTL` answers
`-2`. The client normalises all three onto the two sentinels. A null cannot say
which of the two went missing, so `Get`/`JGet` report `ErrIDNotFound` even for a
missing collection. `Set(...).NX()` over an existing object is a silent no-op,
not an error — use `Exists` if you need to know.

```go
lat, lon, err := c.Get("fleet", "truck1").Point(ctx)
switch {
case errors.Is(err, tile38.ErrIDNotFound):
    // no such object; normal control flow, not a failure
case err != nil:
    return err
}
```

`ErrUnexpectedReply` means the command was accepted but the reply did not decode
— a different problem from a rejection, and retrying will not fix it.
`ErrClosed` is a command issued on a closed `Client`.

## Live geofences

Adding `Fence` opens a `*Stream` instead of returning results. It owns its own
connection, has no read timeout, and must be `Close`d.

```go
st, err := c.Within("zones").Bounds(-90, -180, 90, 180).
    Detect(tile38.Enter, tile38.Exit).Fence(ctx)
if err != nil { return err }
defer st.Close()

for {
    ev, err := st.Next() // io.EOF after Close, ctx.Err() on cancel
    if err != nil { return err }
    fmt.Println(ev.Detect, ev.ID, string(ev.Object))
}
```

`Detect`: `Inside`, `Outside`, `Enter`, `Exit`, `Cross`. A `Nearby` fence can
`Roam("targets", 250)`. `Fence` is on `Nearby`, `Within` and `Intersects` only.

## Everything else

`go doc github.com/GO-VIRTUAL-bv/tile38.go <Symbol>` is the catalog. It is
generated from the code, so unlike this file it cannot be wrong — and every doc
comment carries the protocol quirk that bites at that call site: the 100-result
cap on each `Do`, why `NearbyCmd` has no `Buffer`, the three spellings of a miss
on `ErrIDNotFound`. Read the symbol rather than guessing at it.

The names to look up:

- **Server-side fences** — `SetChan`, `Subscribe`/`PSubscribe`, `SetHook`,
  `Hooks`/`Chans`, `DelHook`/`DelChan`. The sibling `endpoint` package builds the
  fourteen endpoint URL schemes (`endpoint.Kafka`, `endpoint.NATS`, …).
- **More searching** — `Search` (matches stored string values), `Test` with the
  `Area*` constructors, `Buffer`, `WhereEval`/`WhereEvalSha`, `Asc`/`Desc`,
  `Sparse`, `Distance`.
- **Reads and fields** — `Get(…)` terminals `Point`/`PointZ`/`Bounds`/`Object`/
  `Hash`/`A5`/`WithFields`; `FGet`, `FSet`, `FExists`; `FieldOf[T]` and
  `MustFieldOf[T]` to decode a field off a result.
- **Management** — `Del`, `Drop`, `PDel`, `Rename`, `Expire`, `Persist`, `TTL`,
  `Exists`, `Keys`, `Bounds`, `Stats`, `DBSize`, `FlushDB`, `JSet`/`JGet`/`JDel`.
- **Server** — `ConfigGet`/`ConfigSet`/`ConfigRewrite`, `GC`, `Healthz`,
  `AOFShrink`, `ReadOnly`, `Follow`/`FollowNone`, `Timeout`.
- **Batching** — `Pipeline()`, then `.Set(…).Queue()` per write and `Flush(ctx)`.
- **Anything unmodeled** — `c.Do(ctx, "SERVER")` sends a raw command; replies
  decode to `string`, `int64`, `[]any` or `nil`.

Versions

The database has no other skills named tile38.

Database snapshot: 13.11.2026 · package version dd5bea424134 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100nearby
    Use when a request needs to find places or points of interest near a location from self-hosted map data - "every pharmacy within 2 km", "supermarkets near this address", "what is around these coordinates" - and when what you find should be shown on a map. Covers starting the…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.