{"repo":"tidwall/tile38","free":true,"listed":false,"github":"https://github.com/tidwall/tile38","clone":"git clone https://github.com/tidwall/tile38.git","description":"Real-time Geospatial and Geofencing","language":"Go","stars":9714,"topics":["database","geo","geofences","geospatial","index","location","spatial"],"license":"MIT","category":"geospatial_service","readme_excerpt":"<p align=\"center\">\n<picture>\n  <source media=\"(prefers-color-scheme: dark)\" srcset=\"/.github/images/logo-dark.svg\">\n  <source media=\"(prefers-color-scheme: light)\" srcset=\"/.github/images/logo-light.svg\">\n  <img alt=\"Tile38\" src=\"/.github/images/logo-light.svg\" width=\"284\">\n</picture>\n</p>\n<p align=\"center\">\n<a href=\"https://tile38.com/slack/\"><img src=\"https://img.shields.io/badge/Slack-4A154B?logo=slack&logoColor=fff\" alt=\"Slack\"></a>\n<a href=\"https://discord.gg/esq8ESgzms\"><img src=\"https://img.shields.io/badge/Discord-%235865F2.svg?&logo=discord&logoColor=white\" alt=\"Discord\"></a>\n</p>\n\n\n\n\nTile38 is an open source (MIT licensed), in-memory geolocation data store, spatial index, and realtime geofencing server.\nIt supports a variety of object types including lat/lon points, bounding boxes, XYZ tiles, Geohashes, and GeoJSON. \n\n<p align=\"center\">\n<i>This README is quick start document. You can find detailed documentation at <a href=\"https://tile38.com\">https://tile38.com</a>.</i><br><br>\n<a href=\"#searching\"><img src=\"/.github/images/search-nearby.png\" alt=\"Nearby\" border=\"0\" width=\"120\" height=\"120\"></a>\n<a href=\"#searching\"><img src=\"/.github/images/search-within.png\" alt=\"Within\" border=\"0\" width=\"120\" height=\"120\"></a>\n<a href=\"#searching\"><img src=\"/.github/images/search-intersects.png\" alt=\"Intersects\" border=\"0\" width=\"120\" height=\"120\"></a>\n<a href=\"https://tile38.com/topics/geofencing\"><img src=\"/.github/images/geofence.gif\" alt=\"Geofencing\" border=\"0\" width=\"120\" height=\"120\"></a>\n<a href=\"https://tile38.com/topics/roaming-geofences\"><img src=\"/.github/images/roaming.gif\" alt=\"Roaming Geofences\" border=\"0\" width=\"120\" height=\"120\"></a>\n</p>\n\n## Features\n\n- Spatial index with [search](#searching) methods such as Nearby, Within, and Intersects.\n- Realtime [geofencing](#geofencing) through [webhooks](https://tile38.com/commands/sethook) or [pub/sub channels](#pubsub-channels).\n- Object types of [lat/lon](#latlon-point), [bbox](#bounding-box), [Geohash](#geohash), [GeoJSON](#geojson), [QuadKey](#quadkey), and [XYZ tile](#xyz-tile).\n- Support for lots of [Clients Libraries](#tile38-client-libraries) written in many different languages.\n- Variety of protocols, including [http](#http) (curl), [websockets](#websockets), [telnet](#telnet), and the [Redis RESP](https://redis.io/topics/protocol).\n- Server responses are [RESP](https://redis.io/topics/protocol) or [JSON](https://www.json.org).\n- Full [command line interface](#cli).\n- Leader / follower [replication](#replication).\n- In-memory database that persists on disk.\n\n## Components\n- tile38-server: The server\n- tile38-cli: Command line interface tool\n- tile38-benchmark: Server benchmark tool\n\n## Getting Started\n\n### Getting Tile38\n\nPerhaps the easiest way to get the latest Tile38 is to use one of the pre-built release binaries which are available for OSX, Linux, FreeBSD, and Windows. Instructions for using these binaries are on the GitHub [releases page](https://github.com/tidwall/tile38/releases).\n\n### Docker \n\nTo run the latest stable version of Tile38:\n\n```\ndocker pull tile38/tile38\ndocker run -p 9851:9851 tile38/tile38\n```\n\nVisit the [Tile38 hub page](https://hub.docker.com/r/tile38/tile38/) for more information.\n\n### Homebrew (macOS)\n\nInstall Tile38 using [Homebrew](https://brew.sh/)\n\n```sh\nbrew install tile38\ntile38-server\n```\n\n### Building Tile38 \n\nTile38 can be compiled and used on Linux, OSX, Windows, FreeBSD, and probably others since the codebase is 100% Go. We support both 32 bit and 64 bit systems. [Go](https://golang.org/dl/) must be installed on the build machine.\n\nTo build everything simply:\n```\n$ make\n```\n\nTo test:\n```\n$ make test\n```\n\n### Running \nFor command line options invoke:\n```\n$ ./tile38-server -h\n```\n\nTo run a single server:\n\n```\n$ ./tile38-server\n\n# The tile38 shell connects to localhost:9851\n$ ./tile38-cli\n> help\n```\n\n#### Prometheus Metrics\nTile38 can natively export Prometheus metrics by setting the `--metrics-addr` command line flag (disabled by default). This example exposes the HTTP metrics server on port 4321:\n```\n# start server and enable Prometheus metrics, listen on local interface only\n./tile38-server --metrics-addr=127.0.0.1:4321\n\n# access metrics\ncurl http://127.0.0.1:4321/metrics\n```\nIf you need to access the `/metrics` endpoint from a different host you'll have to set the flag accordingly, e.g. set it to `0.0.0.0:<<port>>` to listen on all interfaces.\n\nUse the [redis_exporter](https://github.com/oliver006/redis_exporter) for more advanced use cases like extracting key values or running a lua script.\n\n\n## <a name=\"cli\"></a>Playing with Tile38\n\nBasic operations:\n```\n$ ./tile38-cli\n\n# add a couple of points named 'truck1' and 'truck2' to a collection named 'fleet'.\n> set fleet truck1 point 33.5123 -112.2693   # on the Loop 101 in Phoenix\n> set fleet truck2 point 33.4626 -112.1695   # on the I-10 in Phoenix\n\n# search the 'fleet' collection.\n> scan fleet                                 # returns both trucks in 'fleet'\n> nearby fleet point 33.462 -112.268 6000    # search 6 kilometers around a point. returns one truck.\n\n# key value operations\n> get fleet truck1                           # returns 'truck1'\n> del fleet truck2                           # deletes 'truck2'\n> drop fleet                                 # removes all \n```\n\nTile38 has a ton of [great commands](https://tile38.com/commands).\n\n## Fields\nFields are extra data that belongs to an object. A field is always a double precision floating point. There is no limit to the number of fields that an object can have. \n\nTo set a field when setting an object:\n```\n> set fleet truck1 field speed 90 point 33.5123 -112.2693             \n> set fleet truck1 field speed 90 field age 21 point 33.5123 -112.2693\n```\n\nTo set a field when an object already exists:\n```\n> fset fleet truck1 speed 90\n```\n\nTo get a field when an object already exists:\n```\n> fget fleet truck1 speed\n```\n\n## Searching\n\nTile38 has support to search for objects and points that are within or intersects other objects. All object types can be searched including Polygons, MultiPolygons, GeometryCollections, etc.\n\n<img src=\"/.github/images/search-within.png\" width=\"200\" height=\"200\" border=\"0\" alt=\"Search Within\" align=\"left\">\n\n#### Within \nWITHIN searches a collection for objects that are fully contained inside a specified bounding area.\n<BR CLEAR=\"ALL\">\n\n<img src=\"/.github/images/search-intersects.png\" width=\"200\" height=\"200\" border=\"0\" alt=\"Search Intersects\" align=\"left\">\n\n#### Intersects\nINTERSECTS searches a collection for objects that intersect a specified bounding area.\n<BR CLEAR=\"ALL\">\n\n<img src=\"/.github/images/search-nearby.png\" width=\"200\" height=\"200\" border=\"0\" alt=\"Search Nearby\" align=\"left\">\n\n#### Nearby\nNEARBY searches a collection for objects that intersect a specified radius.\n<BR CLEAR=\"ALL\">\n\n### Search options\n**WHERE** - This option allows for filtering out results based on [field](#fields) values. For example<br>```nearby fleet where speed 70 +inf point 33.462 -112.268 6000``` will return only the objects in the 'fleet' collection that are within the 6 km radius **and** have a field named `speed` that is greater than `70`. <br><br>Multiple WHEREs are concatenated as **and** clauses. ```WHERE speed 70 +inf WHERE age -inf 24``` would be interpreted as *speed is over 70 <b>and</b> age is less than 24.*<br><br>The default value for a field is always `0`. Thus if you do a WHERE on the field `speed` and an object does not have that field set, the server will pretend that the object does and that the value is Zero.<br><br>WHERE expressions support the `=~` operator for regex matching. It uses Go's re2 regular expression engine to match string values in fields or GeoJSON properties within objects. For example, `WHERE properties.name =~ 'truck.*'` filters objects where the 'name' property matches the pattern, and `WHERE field_name =~ 'value.*'` works similarly for fields.\n\n**MATCH** - MATCH is similar to WHERE except that it works on the object id instead of fields.<br>```nearby fleet match truck* point 33.462 -112.268 6000``` will return only the objects in the 'fleet' collection that are within the 6 km radius **and** have an object id that starts with `truck`. There can be multiple MATCH options in a single search. The MATCH value is a simple [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)).\n\n**CURSOR** - CURSOR is used to iterate though many objects from the search results. An iteration begins when the CURSOR is set to Zero or not included with the request, and completes when the cursor returned by the server is Zero.\n\n**NOFIELDS** - NOFIELDS tells the server that you do not want field values returned with the search results.\n\n**LIMIT** - LIMIT can be used to limit the number of objects returned for a single search request.\n\n\n## Geofencing\n\n<img src=\"/.github/images/geofence.gif\" width=\"200\" height=\"200\" border=\"0\" alt=\"Geofence animation\" align=\"left\">\nA <a href=\"https://en.wikipedia.org/wiki/Geo-fence\">geofence</a> is a virtual boundary that can detect when an object enters or exits the area. This boundary can be a radius, bounding box, or a polygon. Tile38 can turn any standard search into a geofence monitor by adding the FENCE keyword to the search. \n\n*Tile38 also allows for [Webhooks](https://tile38.com/commands/sethook) to be assigned to Geofences.*\n\n<br clear=\"all\">\n\nA simple example:\n```\n> nearby fleet fence point 33.462 -112.268 6000\n```\nThis command opens a geofence that monitors the 'fleet' collection. The server will respond with:\n```\n{\"ok\":true,\"live\":true}\n```\nAnd the connection will be kept open. If any object enters or exits the 6 km radius around `33.462,-112.268` the server will respond in realtime with a message such as:\n\n```\n{\"command\":\"set\",\"detect\":\"enter\",\"id\":\"truck02\",\"object\":{\"type\":\"Point\",\"coordinates\":[-112.2695,33.4626]}}\n```\n\nThe server will notify the client if the `command` is `del | set | drop`. \n\n- `del` notifies the client that an object","default_branch":"master","files":173,"tree":[".github/CONTRIBUTING.md",".github/ISSUE_TEMPLATE/bug_report.md",".github/ISSUE_TEMPLATE/config.yml",".github/PULL_REQUEST_TEMPLATE.md",".github/images/geofence.gif",".github/images/logo-auto.svg",".github/images/logo-dark.svg",".github/images/logo-light.svg",".github/images/logo-small.png",".github/images/logo.png",".github/images/roaming.gif",".github/images/search-intersects.png",".github/images/search-nearby.png",".github/images/search-plain.png",".github/images/search-within.png",".github/images/sparse-1.png",".github/images/sparse-2.png",".github/images/sparse-3.png",".github/images/sparse-4.png",".github/images/sparse-5.png",".github/images/sparse-6.png",".github/images/sparse-none.png",".github/workflows/main.yml",".gitignore","CHANGELOG.md","CONTRIBUTING.md","Dockerfile","LICENSE","Makefile","README.md","cmd/tile38-benchmark/az/az.go","cmd/tile38-benchmark/main.go","cmd/tile38-cli/main.go","cmd/tile38-luamemtest/main.go","cmd/tile38-server/main.go","core/commands.go","core/commands.json","core/commands_gen.go","core/commands_test.go","core/gen.sh","core/version.go","go.mod","go.sum","internal/bing/bing.go","internal/bing/bing_test.go","internal/bing/ext.go","internal/bing/ext_test.go","internal/buffer/buffer.go","internal/buffer/buffer_test.go","internal/clip/clip.go","internal/clip/clip_test.go","internal/clip/collection.go","internal/clip/feature.go","internal/clip/linestring.go","internal/clip/point.go","internal/clip/polygon.go","internal/clip/rect.go","internal/collection/collection.go","internal/collection/collection_test.go","internal/collection/geodesic.go","internal/collection/string.go","internal/deadline/deadline.go","internal/endpoint/amqp.go","internal/endpoint/cfqueue.go","internal/endpoint/disque.go","internal/endpoint/endpoint.go","internal/endpoint/eventHub.go","internal/endpoint/grpc.go","internal/endpoint/http.go","internal/endpoint/kafka.go","internal/endpoint/local.go","internal/endpoint/mqtt.go","internal/endpoint/nats.go","internal/endpoint/pubsub.go","internal/endpoint/redis.go","internal/endpoint/scram_client.go","internal/endpoint/sqs.go","internal/field/field.go","internal/field/field_test.go","internal/field/list_binary.go","internal/field/list_struct.go","internal/field/list_test.go","internal/glob/glob.go","internal/glob/glob_test.go","internal/glob/match.go","internal/hservice/gen.sh","internal/hservice/hservice.pb.go","internal/hservice/hservice.proto","internal/log/log.go","internal/log/log_test.go","internal/object/object_binary.go","internal/object/object_struct.go","internal/object/object_test.go","internal/server/a5.go","internal/server/aof.go","internal/server/aofmigrate.go","internal/server/aofshrink.go","internal/server/bson.go","internal/server/bson_test.go","internal/server/checksum.go","internal/server/client.go","internal/server/config.go","internal/server/crud.go","internal/server/dev.go","internal/server/expire.go","internal/server/expr.go","internal/server/expression.go","internal/server/fence.go","internal/server/follow.go","internal/server/group.go","internal/server/hooks.go","internal/server/json.go","internal/server/json_test.go","internal/server/keys.go","internal/server/live.go","internal/server/metrics.go","internal/server/monitor.go","internal/server/must.go","internal/server/must_test.go","internal/server/mvt.go","internal/server/mvt_test.go","internal/server/output.go","internal/server/pubqueue.go","internal/server/pubsub.go","internal/server/readonly.go","internal/server/respconn.go","internal/server/scan.go","internal/server/scanner.go","internal/server/scanner_test.go","internal/server/scripts.go","internal/server/search.go","internal/server/server.go","internal/server/stats.go","internal/server/stats_cpu.go","internal/server/stats_cpu_darlin.go","internal/server/test.go","internal/server/token.go","internal/server/token_test.go","internal/sstring/sstring.go","internal/sstring/sstring_test.go","internal/viewer/index.html","internal/viewer/logo.png","internal/viewer/viewer.go","scripts/RELEASE.md","scripts/build.sh","scripts/docker-push.sh","scripts/package.sh","scripts/test.sh","tests/107/.gitignore","tests/107/LINK","tests/107/main.go","tests/616/main.go","tests/README.md","tests/aof_legacy","tests/aof_test.go","tests/client_test.go","tests/fence_roaming_test.go","tests/fence_test.go","tests/follower_test.go","tests/json_test.go","tests/keys_A5_test.go","tests/keys_search_test.go","tests/keys_test.go","tests/metrics_test.go","tests/mock_io_test.go","tests/mock_test.go","tests/monitor_test.go","tests/proto_test.go","tests/scripts_test.go","tests/stats_test.go","tests/testcmd_test.go","tests/tests_test.go","tests/timeout_test.go"],"storefront":"/r/tidwall","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/tidwall/tile38/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}