{"id":15887920,"url":"https://github.com/iwpnd/piper","last_synced_at":"2025-03-20T08:33:05.934Z","repository":{"id":57656477,"uuid":"457971294","full_name":"iwpnd/piper","owner":"iwpnd","description":"yet another point in polygon package","archived":false,"fork":false,"pushed_at":"2022-10-15T08:20:15.000Z","size":37,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-15T15:39:40.554Z","etag":null,"topics":["geometry","geometry-processing","geospatial","geospatial-processing","golang"],"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/iwpnd.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}},"created_at":"2022-02-10T22:42:35.000Z","updated_at":"2024-01-11T06:15:36.000Z","dependencies_parsed_at":"2022-08-26T05:51:09.403Z","dependency_job_id":null,"html_url":"https://github.com/iwpnd/piper","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwpnd%2Fpiper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwpnd%2Fpiper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwpnd%2Fpiper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwpnd%2Fpiper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iwpnd","download_url":"https://codeload.github.com/iwpnd/piper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244066237,"owners_count":20392405,"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","geometry-processing","geospatial","geospatial-processing","golang"],"created_at":"2024-10-06T06:05:42.705Z","updated_at":"2025-03-20T08:33:05.661Z","avatar_url":"https://github.com/iwpnd.png","language":"Go","readme":"# piper\n\nYet another point in polygon package. Piper makes use of ray casting and does account for holes in polygons.\n\n## Installation\n\n```\ngo get -u github.com/iwpnd/piper\n```\n\n## Usage\n\nVanilla\n\n```go\npackage main\n\nimport (\n  \"fmt\"\n\n  \"github.com/iwpnd/piper\"\n  )\n\nfunc main() {\n  p := []float64{0.5,0.5} // [longitude, latitude]\n  polygon := [][][]float64{{{0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}}}\n\n  pip := piper.Pip(p, polygon)\n  fmt.Printf(\"Point in Polygon: %+v\\n\", pip)\n}\n```\n\nOr using [github/paulmach/go.geojson](https://github.com/paulmach/go.geojson)\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\n\t\"github.com/iwpnd/piper\"\n\t\"github.com/paulmach/go.geojson\"\n)\n\nfunc main() {\n\tp := []float64{0.5, 0.5} // [longitude, latitude]\n\n\traw, err := ioutil.ReadFile(\"my_feature.geojson\")\n\tif err != nil {\n\t\tpanic(\"something went wrong\")\n\t}\n\n\tvar feature geojson.Feature\n\terr = json.Unmarshal(raw, \u0026feature)\n\tif err != nil {\n\t\tpanic(\"something went wrong\")\n\t}\n\n\tpip := piper.Pip(p, feature.Geometry.Polygon)\n\tfmt.Printf(\"Point in Polygon: %+v\\n\", pip)\n}\n```\n\n## Benchmark\n\n```\ngoos: darwin\ngoarch: amd64\npkg: github.com/iwpnd/piper\ncpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz\nBenchmarkPipSimpleInside-12              \t43108360\t        27.73 ns/op\nBenchmarkPipSimpleOutside-12             \t44025870\t        27.53 ns/op\nBenchmarkPipSimpleInsideWithHoles-12     \t27355524\t        42.84 ns/op\nBenchmarkPipSimpleOutsideWithHoles-12    \t42239286\t        28.22 ns/op\nBenchmarkPipComplexInside-12             \t  474601\t        2323 ns/op\n```\n\n## License\n\nMIT\n\n## Maintainer\n\nBenjamin Ramser - [@iwpnd](https://github.com/iwpnd)\n\nProject Link: [https://github.com/iwpnd/piper](https://github.com/iwpnd/piper)\n\n## Acknowledgement\n\nPhillip Lemons - [Ray Casting Algorithm](http://philliplemons.com/posts/ray-casting-algorithm)\n\nGreat introduction into the topic with good visualisations.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwpnd%2Fpiper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiwpnd%2Fpiper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwpnd%2Fpiper/lists"}