Tile38 Documentation
repository·master·Indexed 27 days ago
https://github.com/tidwall/tile38Tile38 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.
What's inside Tile38
- Tile38 is written in Go and can be compiled on Linux, OSX, Windows, and FreeBSD. Go must be installed on the build machine.
Use Geofence Pub/Sub channels
masterYou can deliver geofence notifications over Tile38 pub/sub channels using thesetchancommand. This allows clients to subscribe to specific geofence events without maintaining a persistent connection to the search command.Install Tile38 via Homebrew (macOS)
masterInstall Tile38 using Homebrew and then start the server.
brew install tile38 tile38-serverUse HTTP to call Tile38 commands
masterYou can interact with Tile38 via HTTP using
curlor 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.10923Use Telnet and RESP protocol
masterYou 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 +OKUse Websockets for Geofencing
masterWebsockets 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.Install Tile38 via Docker
masterTo run the latest stable version of Tile38 using Docker, pull the image and run it with port 9851 exposed.
docker pull tile38/tile38 docker run -p 9851:9851 tile38/tile38Implement Geofencing
masterA geofence is a virtual boundary (radius, bounding box, or polygon) that detects when objects enter or exit. Adding theFENCEkeyword to a search command turns it into a real-time geofence monitor.Configure Prometheus metrics in Tile38
masterTile38 can export Prometheus metrics using the--metrics-addrflag. By default, this is disabled. To listen only on the local interface, specify a local IP. To allow external access, use0.0.0.0.Use the tile38-cli tool
masterThetile38-cliis 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.Use monitor and live mode in tile38-cli
masterThe CLI can enter a 'live mode' to stream real-time updates from the server, such as those fromMONITORorSUBSCRIBE/PSUBSCRIBEcommands.Get help for Tile38 commands in the CLI
masterThetile38-cliprovides built-in help documentation. You can explore commands by group or get specific details for a single command.