{"id":17217068,"url":"https://github.com/akhenakh/tgo","last_synced_at":"2025-04-13T23:23:34.250Z","repository":{"id":226422467,"uuid":"696504323","full_name":"akhenakh/tgo","owner":"akhenakh","description":"Go bindings for TG Fast point-in-polygon Geometry","archived":false,"fork":false,"pushed_at":"2024-12-31T02:12:19.000Z","size":432,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T13:40:15.914Z","etag":null,"topics":["geometry","point-in-polygon","polygon"],"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/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-09-25T22:00:04.000Z","updated_at":"2024-12-31T02:12:23.000Z","dependencies_parsed_at":"2024-03-07T14:39:47.083Z","dependency_job_id":"2c5521a7-c4f1-4c4c-9bf5-aecb859afa1d","html_url":"https://github.com/akhenakh/tgo","commit_stats":null,"previous_names":["akhenakh/tgo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhenakh%2Ftgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhenakh%2Ftgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhenakh%2Ftgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akhenakh%2Ftgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akhenakh","download_url":"https://codeload.github.com/akhenakh/tgo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248795184,"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":["geometry","point-in-polygon","polygon"],"created_at":"2024-10-15T03:43:11.901Z","updated_at":"2025-04-13T23:23:34.208Z","avatar_url":"https://github.com/akhenakh.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"tgo\n---\n![Tests](https://github.com/akhenakh/tgo/actions/workflows/build.yml/badge.svg)\n\n[![GoDoc](https://pkg.go.dev/badge/github.com/akhenakh/tgo)](https://pkg.go.dev/github.com/akhenakh/tgo)\n\n[\u003cimg src=\"img/tgo.jpg\"\u003e](https://github.com/akhenakh/tgo/)\n\nGo bindings for [tidwall/tg](https://github.com/tidwall/tg) Geometry library for C - Fast point-in-polygon \n\nThis is partial but functional, tg is a very small self contained C library, tgo compiles tg, no external dependencies needed.\n\n## Usage\n\nSimply go get this library with CGO enabled (you'll need a C compiler).\n\n#### Read from WKT\n```go\n// Unmarshal from WKT\ninput := \"POLYGON((0 0,0 1,1 1,1 0,0 0))\"\ng, _ := tgo.UnmarshalWKT(input)\n\n// Marshal to WKT\noutput := g.AsText()\nfmt.Println(output) // Prints: POLYGON((0 0,0 1,1 1,1 0,0 0))\n```\n\n#### Read from GeoJSON\n```go\ninput := `{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"coordinates\":[-79.20159897229003,43.636785010689835],\"type\":\"Point\"}}`\ng, _ := tgo.UnmarshalGeoJSON(input)\n```\n\n#### Read from WKB\n```go\ninput := []byte{1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 63, 0, 0, 0, 0, 0, 0, 4, 64}\ng, _ := tgo.UnmarshalWKB(input)\n```\n\n#### Intersects\n```go\nif Intersects(g1, g2) {\n\tfmt.Println(\"Intersects\")\n}\n```\n\n#### Point in Polygon on large FeatureCollections\n```go\n\n// load your collection using UnmarshalGeoJSON\nfound := g.StabOne(2, 48)\nif found != nil {\n\tfmt.Println(found.Properties())\n}\n// Output: {\"properties\":{ \"ADMIN\": \"France\", \"ISO_A2\": \"FR\", \"ISO_A3\": \"FRA\" }}\n```\n\n#### Types\n\n```go\ninput := \"POLYGON((0 0,0 1,1 1,1 0,0 0))\"\ng, _ := tgo.UnmarshalWKT(input)\n\nif g.Types() == tgo.Polygon() {\n\tp, _ := g.AsPoly()\n\tp.HolesCount()\n}\n```\n\n## Tests\n\nSome tests are borrowed from [simplefeatures](https://github.com/peterstace/simplefeatures).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakhenakh%2Ftgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakhenakh%2Ftgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakhenakh%2Ftgo/lists"}