{"id":27395653,"url":"https://github.com/akhenakh/geo-bento","last_synced_at":"2026-03-15T22:00:56.153Z","repository":{"id":164249468,"uuid":"639679107","full_name":"akhenakh/geo-bento","owner":"akhenakh","description":"Benthos plugins to transform geographic coordinates from a stream.","archived":false,"fork":false,"pushed_at":"2025-03-27T16:18:47.000Z","size":346,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T17:27:52.956Z","etag":null,"topics":["benthos","geographic","gis","h3","pip","point-in-polygon","redpanda-connect","s2","stream-processing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akhenakh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-12T01:41:52.000Z","updated_at":"2025-03-27T16:17:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"e079ece9-5f3b-4cf6-a216-5e8905fef9e6","html_url":"https://github.com/akhenakh/geo-bento","commit_stats":null,"previous_names":["akhenakh/geo-bento"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhenakh%2Fgeo-bento","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhenakh%2Fgeo-bento/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhenakh%2Fgeo-bento/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhenakh%2Fgeo-bento/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akhenakh","download_url":"https://codeload.github.com/akhenakh/geo-bento/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248795181,"owners_count":21162726,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benthos","geographic","gis","h3","pip","point-in-polygon","redpanda-connect","s2","stream-processing"],"created_at":"2025-04-13T23:23:16.244Z","updated_at":"2026-03-15T22:00:56.107Z","avatar_url":"https://github.com/akhenakh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Geo-Bento\n\n[Bento](https://warpstreamlabs.github.io/bento) plugins to transform geographic coordinates from a stream.\n\nBento is the swiss army of stream processing: Bento solves common data engineering tasks such as transformations, integrations, and multiplexing with declarative and unit testable configuration.\n\nThis repo contains multiple Bento plugins as Go modules, that you can build on demand (see `cmd/geo-bento`).\n\nNote that the h3 plugin is using a [CGO free version](https://github.com/akhenakh/goh3).\n\n\n## Get the country for a latitude and longitude\n\nUse `country` with the following parameters: `latitude`, `longitude`.\n\nAn example `position.json`:\n\n```js\n{\"id\":42, \"lat\": 48.86, \"lng\": 2.34}\n```\n\nA `country.yaml` pipeline.\n\n```yaml\ninput:\n  file:\n    paths: [\"testdata/position.json\"]\n    codec: all-bytes\n\npipeline:\n  threads: 1\n  processors:\n  - mapping: |\n      #!blobl\n      root = this\n      root.country = country(this.lat, this.lng)\n\noutput:\n  label: \"out\"\n  stdout:\n    codec: lines\n```\n\nEnrich the input with the timezone:\n\n```sh\ngo build -o geo-0bento ./cmd/geo-bento\n./geo-bento -c testdata/country.yaml\n{\"country\":[\"France\"],\"id\":42,\"lat\":48.86,\"lng\":2.34}\n```\n\ncountry module is using [coord2country](https://github.com/akhenakh/coord2country).\n\n## Transform latitude and longitude into an Uber h3 cell\n\nUse `h3` with the following parameters: `latitude`, `longitude`, `resolution`.\n\nAn example `position.json`:\n\n```js\n{\"id\":42, \"lat\": 48.86, \"lng\": 2.34}\n```\n\nA `h3.yaml` pipeline.\n\n```yaml\ninput:\n  file:\n    paths: [\"testdata/position.json\"]\n    codec: all-bytes\n\npipeline:\n  threads: 1\n  processors:\n  - mapping: |\n      #!blobl\n      root = this\n      root.h3 = h3(this.lat, this.lng, 5)\n\noutput:\n  label: \"out\"\n  stdout:\n    codec: lines\n```\n\nEnrich the input with the h3 cell:\n\n```sh\ngo build -o geo-bento ./cmd/geo-bento\n./geo-bento -c testdata/h3.yaml\n{\"h3\":\"851fb467fffffff\",\"id\":42,\"lat\":48.86,\"lng\":2.34}\n```\n\n## Transform latitude and longitude into an A5 cell\n\nUse `a5` with the following parameters: `latitude`, `longitude`, `resolution`.\n\nAn example `position.json`:\n\n```js\n{\"id\":42, \"lat\": 48.86, \"lng\": 2.34}\n```\n\nA `a5.yaml` pipeline.\n\n```yaml\ninput:\n  file:\n    paths: [\"testdata/position.json\"]\n    codec: all-bytes\n\npipeline:\n  threads: 1\n  processors:\n  - mapping: |\n      #!blobl\n      root = this\n      root.a5 = a5(this.lat, this.lng, 5)\n\noutput:\n  label: \"out\"\n  stdout:\n    codec: lines\n```\n\nEnrich the input with the a5 cell:\n\n```sh\ngo build -o geo-bento ./cmd/geo-bento\n./geo-bento -c testdata/a5.yaml\n{\"a5\":\"63c2000000000000\", \"id\":42,\"lat\":48.86,\"lng\":2.34}\n```\n\na5 module is using [a5-go](https://github.com/akhenakh/a5-go).\n\n## Transform latitude and longitude into a Google s2 cell\n\nUse `s2` with the following parameters: `latitude`, `longitude`, `resolution`.\n\nAn example `position.json`:\n\n```js\n{\"id\":42, \"lat\": 48.86, \"lng\": 2.34}\n```\n\nA `s2.yaml` pipeline.\n\n```yaml\ninput:\n  file:\n    paths: [\"testdata/position.json\"]\n    codec: all-bytes\n\npipeline:\n  threads: 1\n  processors:\n  - mapping: |\n      #!blobl\n      root = this\n      root.s2 = s2(this.lat, this.lng, 15)\n\noutput:\n  label: \"out\"\n  stdout:\n    codec: lines\n```\n\nEnrich the input with the s2 cell:\n\n```sh\ngo build -o geo-bento ./cmd/geo-bento\n./geo-bento -c testdata/s2.yaml\n{\"id\":42,\"lat\":48.86,\"lng\":2.34,\"s2\":\"2/033303031301002\"}\n```\n\n## Get the timezone for a given latitude and longitude\n\nUse `tz` with the following parameters: `latitude`, `longitude`.\n\nAn example `position.json`:\n\n```js\n{\"id\":42, \"lat\": 48.86, \"lng\": 2.34}\n```\n\nA `tz.yaml` pipeline.\n\n```yaml\ninput:\n  file:\n    paths: [\"testdata/position.json\"]\n    codec: all-bytes\n\npipeline:\n  threads: 1\n  processors:\n  - mapping: |\n      #!blobl\n      root = this\n      root.tz = tz(this.lat, this.lng)\n\noutput:\n  label: \"out\"\n  stdout:\n    codec: lines\n```\n\nEnrich the input with the timezone:\n\n```sh\ngo build -o geo-bento ./cmd/geo-bento\n./geo-bento -c testdata/tz.yaml\n{\"tz\":\"Europe/Paris\",\"id\":42,\"lat\":48.86,\"lng\":2.34}\n```\n\ntz module is using [tzf](https://github.com/ringsaturn/tzf).\n\n## Generate random position in a range (mainly for debug)\n\nThis is an input plugin that will generate random coordinates in your range.\n\n```yaml\ninput:\n  randpos:\n    min_lat: 46.0\n    max_lat: 48.0\n    min_lng: 2.0\n    max_lng: 2.3\n\noutput:\n  label: \"out\"\n  stdout:\n    codec: lines\n```\n## Example\n\nUse the random position generator, to use all plugins.\n```yaml\ninput:\n  randpos:\n    min_lat: 46.0\n    max_lat: 48.0\n    min_lng: 2.0\n    max_lng: 2.3\npipeline:\n  threads: 1\n  processors:\n  - mapping: |\n      #!blobl\n      root = this\n      root.h3 = h3(this.lat, this.lng, 12)\n      root.country = country(this.lat, this.lng)\n      root.s2 = s2(this.lat, this.lng, 15)\n      root.tz = tz(this.lat, this.lng)\n      \noutput:\n  label: \"out\"\n  stdout:\n    codec: lines\n```\n\n## Live Testing\n\nRun this command and point your browser to http://localhost:4195/\n\n```sh\n./cmd/geo-bento blobl server --no-open --host 0.0.0.0 --input-file ./testdata/position.json -m testdata/all.yaml\n```\n\n## Docker\n\nA pre built binary is also availale as a docker image:\n\n```sh\n docker pull ghcr.io/akhenakh/geo-bento:latest\n```\n\n## TODO\n\n- [ ] s2 shape index to perform PIP\n- [ ] spatialite lookup to perform PIP\n- [X] random points in a rect\n- [X] lat lng to h3\n- [X] lat lng to s2\n- [X] lat lng to a5\n- [X] lat lng to tz\n- [X] lat lng to country\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakhenakh%2Fgeo-bento","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakhenakh%2Fgeo-bento","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakhenakh%2Fgeo-bento/lists"}