{"id":19585472,"url":"https://github.com/stremovskyy/geo_fencer","last_synced_at":"2026-05-16T19:09:25.631Z","repository":{"id":104253052,"uuid":"214995376","full_name":"stremovskyy/geo_fencer","owner":"stremovskyy","description":"Simple Geo fence library","archived":false,"fork":false,"pushed_at":"2023-03-03T14:26:11.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T10:06:52.071Z","etag":null,"topics":["bbox","btree","geofencing","geolocation","golang","golang-library","s2"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stremovskyy.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}},"created_at":"2019-10-14T08:57:45.000Z","updated_at":"2023-03-03T14:12:36.000Z","dependencies_parsed_at":"2023-07-13T22:09:23.040Z","dependency_job_id":"c65c4335-bcee-4e09-b2a6-5bcf91083c6e","html_url":"https://github.com/stremovskyy/geo_fencer","commit_stats":null,"previous_names":["karmadon/geo_fencer"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stremovskyy%2Fgeo_fencer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stremovskyy%2Fgeo_fencer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stremovskyy%2Fgeo_fencer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stremovskyy%2Fgeo_fencer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stremovskyy","download_url":"https://codeload.github.com/stremovskyy/geo_fencer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240858578,"owners_count":19868998,"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":["bbox","btree","geofencing","geolocation","golang","golang-library","s2"],"created_at":"2024-11-11T07:54:16.359Z","updated_at":"2026-05-16T19:09:20.576Z","avatar_url":"https://github.com/stremovskyy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# geo_fencer - Simple Geo fence library\n\n`geo_fencer` is a simple Go package for creating and searching geographic fences. It provides an interface for creating an index of multiple fences, making it easy to search for coordinates across different data sets.\n\n## Installation\n\nTo install the package, use go get:\n```shell\ngo get github.com/stremovskyy/geo_fencer\n```\n\n## Usage\nTo use geo_fencer, you need to first create a GeoFence object. You can then add features to the fence, which are essentially geographic shapes (such as polygons or circles) that define the boundaries of the fence.\n\nOnce you have created a fence, you can add it to a FenceIndex, which is a dictionary of multiple fences. You can then search for a coordinate in any of the indexed fences.\n\n```go\nimport (\n    \"github.com/stremovskyy/geo_fencer\"\n    \"github.com/stremovskyy/geo\"\n)\n\n// Create a fence\nfence, err := geo_fencer.GetFence(geo_fencer.GeoFenceTypeCircle, 10)\nif err != nil {\n    panic(err)\n}\n\n// Add a feature to the fence\ncenter := geo.NewPoint(-122.431297, 37.773972)\nradius := 1000.0\nfeature := geo.NewCircle(center, radius)\nfence.Add(feature)\n\n// Create an index of fences\nfences := geo_fencer.NewFenceIndex()\nfences.Set(\"my_fence\", fence)\n\n// Search for a coordinate\ncoord := geo.NewPoint(-122.431297, 37.773972)\nmatch, err := fences.Search(\"my_fence\", coord)\nif err != nil {\n    panic(err)\n}\nfmt.Println(match)\n\n```\n\nYou can also load a fence index from a GeoJSON string using the LoadFenceIndex function:\n```go\ngeoJsonString := `{\n    \"type\": \"FeatureCollection\",\n    \"features\": [\n        {\n            \"type\": \"Feature\",\n            \"geometry\": {\n                \"type\": \"Polygon\",\n                \"coordinates\": [\n                    [\n                        [-122.4412, 37.7776],\n                        [-122.4412, 37.7818],\n                        [-122.4356, 37.7818],\n                        [-122.4356, 37.7776],\n                        [-122.4412, 37.7776]\n                    ]\n                ]\n            }\n        }\n    ]\n}`\n\nfences, err := geo_fencer.LoadFenceIndex(geo_fencer.GeoFenceTypePolygon, 10, \"my_fence\", \u0026geoJsonString)\nif err != nil {\n    panic(err)\n}\n\ncoord := geo.NewPoint(-122.4384, 37.7797)\nmatch, err := fences.Search(\"my_fence\", coord)\nif err != nil {\n    panic(err)\n}\nfmt.Println(match)\n```\n\n## License\n\ngeo_fencer is licensed under the MIT License. See [LICENSE](LICENSE) for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstremovskyy%2Fgeo_fencer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstremovskyy%2Fgeo_fencer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstremovskyy%2Fgeo_fencer/lists"}