{"id":36707054,"url":"https://github.com/icha024/go-geoindex","last_synced_at":"2026-01-12T11:43:42.499Z","repository":{"id":57508850,"uuid":"43523687","full_name":"icha024/go-geoindex","owner":"icha024","description":"In-Memory GeoIndex for Go (Lang)","archived":false,"fork":false,"pushed_at":"2023-06-08T15:42:47.000Z","size":105,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T12:05:13.341Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icha024.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":"2015-10-01T22:04:32.000Z","updated_at":"2022-04-29T20:27:22.000Z","dependencies_parsed_at":"2024-06-20T11:25:08.636Z","dependency_job_id":null,"html_url":"https://github.com/icha024/go-geoindex","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/icha024/go-geoindex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icha024%2Fgo-geoindex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icha024%2Fgo-geoindex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icha024%2Fgo-geoindex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icha024%2Fgo-geoindex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icha024","download_url":"https://codeload.github.com/icha024/go-geoindex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icha024%2Fgo-geoindex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:58:46.209Z","status":"ssl_error","status_checked_at":"2026-01-12T10:58:42.742Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-01-12T11:43:42.424Z","updated_at":"2026-01-12T11:43:42.484Z","avatar_url":"https://github.com/icha024.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-geoindex\n\n### A simple in-memory geoindex for Go, based on the geohash-int library.\n\nProximity search largely based on the StackExchange discussion:\n- http://gis.stackexchange.com/questions/18330/would-it-be-possible-to-use-geohash-for-proximity-searches/92331#92331\n\nOriginal geohash-int library:\n- https://github.com/yinqiwen/geohash-int\n\nThe modified fork of the geohash-int:\n- https://github.com/mattsta/geohash-int\n\nSome more documentations:\n- https://github.com/yinqiwen/ardb/blob/master/doc/spatial-index.md\n- https://matt.sh/redis-geo#_how-it-works\n\n\n## Usage\n### Add location:\n```go\nprop := []string{\"property1\", \"property2\"}\nlocationID, err := geoindex.AddLocation(\u0026GeoData{Latitude: latitude, Longitude: longitude, Properties: \u0026prop})\n```\n\n**Initialize search index** (optional) - Otherwise it will trigger an indexed on the first search.\n```go\ngeoindex.InitSearch()\n```\n\n### Search locations:\nSearch at latitude/longitude (-32.1, 120.3) within a 12 km bound.\n```go\nlocations := geoindex.SearchBound(-32.2, 120.3, 12)\n```\n\n### Get location details:\nGet details by ID.\n```go\nlocationID := 12345 // Either from add operation, or from search results.\ngeoindex.GetLocation(locationID)\n```\n\n## Performance\n*This is only meant to be an approximate tests for my use-case - embedding geo search function into a webapp.*\n\nTested with a simple local HTTP server (no cache) in plain Go lang 1.6 and Apache Bench. Using a HTTP GET search operation that returns data in GeoJson format, on Ubuntu 16.04 with i7 (4790s) CPU (capped at 3.2GHz and 6vcore).\n\n#### (Basic) Total 30 locations in the system, search 10 km bound to return 2 records.\n\nOver 26,000 TPS for basic dataset when exposed as a HTTP services\n\n```\nConcurrency Level:      10\nTime taken for tests:   1.871 seconds\nComplete requests:      50000\nFailed requests:        0\nTotal transferred:      23150000 bytes\nHTML transferred:       17250000 bytes\nRequests per second:    26719.59 [#/sec] (mean)\nTime per request:       0.374 [ms] (mean)\nTime per request:       0.037 [ms] (mean, across all concurrent requests)\nTransfer rate:          12081.22 [Kbytes/sec] received\n\nConnection Times (ms)\n              min  mean[+/-sd] median   max\nConnect:        0    0   0.0      0       1\nProcessing:     0    0   0.1      0       3\nWaiting:        0    0   0.1      0       3\nTotal:          0    0   0.1      0       3\n\nPercentage of the requests served within a certain time (ms)\n  50%      0\n  66%      0\n  75%      0\n  80%      0\n  90%      0\n  95%      1\n  98%      1\n  99%      1\n 100%      3 (longest request)\n```\n\n#### (Normal) Total 443,969 locations in the system, search 1 km bound to return 42 records.\n\nAround 14,000 TPS for norminal conditions.\n\n```\nConcurrency Level:      10\nTime taken for tests:   3.591 seconds\nComplete requests:      50000\nFailed requests:        0\nTotal transferred:      324150000 bytes\nHTML transferred:       319300000 bytes\nRequests per second:    13923.68 [#/sec] (mean)\nTime per request:       0.718 [ms] (mean)\nTime per request:       0.072 [ms] (mean, across all concurrent requests)\nTransfer rate:          88151.60 [Kbytes/sec] received\n\nConnection Times (ms)\n              min  mean[+/-sd] median   max\nConnect:        0    0   0.0      0       3\nProcessing:     0    1   1.4      1      79\nWaiting:        0    1   1.4      0      79\nTotal:          0    1   1.4      1      79\n\nPercentage of the requests served within a certain time (ms)\n  50%      1\n  66%      1\n  75%      1\n  80%      1\n  90%      1\n  95%      1\n 100%     79 (longest request)\n```\n\n#### (Extreme) Total 443,969 locations in the system, search 10 km bound to return 490 records.\n\nClose to 1000 TPS for extremely large dataset and high HTTP overhead/traffic.\n(When we limit HTTP server to only send the first 250 records, the TPS jumps to around 900)\n\n```\nConcurrency Level:      10\nTime taken for tests:   10.000 seconds\nComplete requests:      9728\nFailed requests:        0\nTotal transferred:      375577600 bytes\nHTML transferred:       374633790 bytes\nRequests per second:    972.75 [#/sec] (mean)\nTime per request:       10.280 [ms] (mean)\nTime per request:       1.028 [ms] (mean, across all concurrent requests)\nTransfer rate:          36675.73 [Kbytes/sec] received\n\nConnection Times (ms)\n              min  mean[+/-sd] median   max\nConnect:        0    0   0.0      0       0\nProcessing:     2   10  12.7      6     106\nWaiting:        2    9  12.0      5     105\nTotal:          2   10  12.7      6     106\n\nPercentage of the requests served within a certain time (ms)\n  50%      6\n  66%      9\n  75%     11\n  80%     12\n  90%     15\n  95%     23\n  98%     66\n  99%     81\n 100%    106 (longest request)\n```\n\n## Limitations\n* Search bounds are approximate square, and become gradually curved as the area increases.\n* [Latitude/Longitude approximation:](http://stackoverflow.com/questions/1253499/simple-calculations-for-working-with-lat-lon-km-distance)\n  * 1 deg latitude = 110.574 km\n  * 1 deg longitude = 111.320*cos(latitude) km\n* This geohash based proximity search does not search across the boundary at the poles (0) and at the international date line (180/-180).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficha024%2Fgo-geoindex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficha024%2Fgo-geoindex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficha024%2Fgo-geoindex/lists"}