Tile38 Documentation

repository·master·Indexed 27 days ago

https://github.com/tidwall/tile38

Tile38 is an in-memory geolocation data store, spatial index, and realtime geofencing server designed for high-performance spatial queries and real-time event detection. It supports storing lat/lon points, bounding boxes, geohashes, and GeoJSON objects. The server can be interacted with via a dedicated CLI, HTTP, Websockets, and the Redis RESP protocol. It features advanced filtering with WHERE and MATCH clauses, real-time geofence monitoring via the FENCE keyword, and pub/sub channels for event notifications.

Tokens
3K
Snippets
12
Records
32
Agent score
95%

What's inside Tile38

  1. Use Geofence Pub/Sub channels

    master
    You can deliver geofence notifications over Tile38 pub/sub channels using the setchan command. This allows clients to subscribe to specific geofence events without maintaining a persistent connection to the search command.
  2. Use HTTP to call Tile38 commands

    master

    You can interact with Tile38 via HTTP using curl or other HTTP clients. Commands can be sent in the request body or as part of the URL path.

    Note: HTTP and Websockets use JSON for communication.

    # call with request in the body
    curl --data "set fleet truck3 point 33.4762 -112.10923" localhost:9851
    
    # call with request in the url path
    curl localhost:9851/set+fleet+truck3+point+33.4762+-112.10923
  3. Use Telnet and RESP protocol

    master

    You can use a plain telnet connection to interact with Tile38. Telnet and other RESP clients use the RESP (Redis Serialization Protocol). The server responds in JSON or RESP depending on which protocol is used when initiating the first command.

    telnet localhost 9851
    set fleet truck3 point 33.4762 -112.10923
    +OK
  4. Use Websockets for Geofencing

    master
    Websockets are recommended when you need to perform Geofencing and keep a connection alive. The connection remains open, and the server sends data as text websocket messages. Websocket communication uses JSON.
  5. Implement Geofencing

    master
    A geofence is a virtual boundary (radius, bounding box, or polygon) that detects when objects enter or exit. Adding the FENCE keyword to a search command turns it into a real-time geofence monitor.
  6. Configure Prometheus metrics in Tile38

    master
    Tile38 can export Prometheus metrics using the --metrics-addr flag. By default, this is disabled. To listen only on the local interface, specify a local IP. To allow external access, use 0.0.0.0.
  7. Use the tile38-cli tool

    master
    The tile38-cli is a command-line interface for interacting with a Tile38 server. It can be used in an interactive shell mode or for executing single commands. You can specify the server connection details via command-line flags or environment variables.