{"id":19672020,"url":"https://github.com/michelp/pgs2","last_synced_at":"2025-07-12T08:03:58.341Z","repository":{"id":43364368,"uuid":"424992211","full_name":"michelp/pgs2","owner":"michelp","description":"Postgres extension for S2 spherical geometry","archived":false,"fork":false,"pushed_at":"2021-11-24T08:04:00.000Z","size":80,"stargazers_count":17,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-05T12:11:24.148Z","etag":null,"topics":["postgresql","s2","spherical-coordinates"],"latest_commit_sha":null,"homepage":"","language":"C","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/michelp.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":"2021-11-05T15:15:39.000Z","updated_at":"2024-03-22T23:11:05.000Z","dependencies_parsed_at":"2022-07-08T20:17:16.492Z","dependency_job_id":null,"html_url":"https://github.com/michelp/pgs2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fpgs2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fpgs2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fpgs2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michelp%2Fpgs2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michelp","download_url":"https://codeload.github.com/michelp/pgs2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251415585,"owners_count":21585857,"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":["postgresql","s2","spherical-coordinates"],"created_at":"2024-11-11T17:10:37.817Z","updated_at":"2025-04-29T01:30:39.591Z","avatar_url":"https://github.com/michelp.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pgs2\n\nPostgres extension for [S2 spherical geometry](https://s2geometry.io/).\n\n## Fixed Length Types\n\nThese fixed length types are stored \"flat\" and only turned into S2\ninstances at the point of use.  They are stored very efficiently by\nPostgres.\n\n### S2Point\n\nStored as 3 double precision floats.\n\n### S2Cap\n\nPoint and radius stored as 4 doubles.\n\n### S2LatLng\n\nStored as 2 doubles.\n\n### S2LatLngRect\n\nStored as 4 doubles.\n\n### S2Cell\n\nAn S2CellId is an unsigned 64bit integer, but since Postgres doesn't\nhave unsigned integer types, it's SQL literal representation is an\nS2Cell \"token\" string.  The token is decoded into an unsigned int64\nand stored optimally.\n\nCells can be cast to S2Point and S2LatLng by returning their center\npoint.  S2Point and S2LatLng can be cast to a cell.  Normally there is\nexactly one such cell for a given point, but for points along cell\nboundaries one cell id detiministically chosen:\n\n```\n\n```\n\n\n## TODO Variable Length S2Region Types\n\nThese types are variable length \"expanded\" types, they are stored in a\nflattened representation using S2 Encoder/Decoder and automatically\nexpanded into live objects as needed when loaded into memory.\n\n### S2Polyline\n\n### S2Loop\n\n### S2Polygon\n\n## TODO Aggregate S2Builder\n\nS2Builder is wrapped by an aggregate, any region can be added to the\nbuilder.\n\n  `select s2builder(region, layer_name) as from ... where ...;`\n\ns2builder supports all current geometry types.\n\n## TODO Indexing\n\n### S2Cell Token btree with text_pattern_ops\n\n### S2CellId QuadTree with SP-GIST TODO\n\n### S2RegionTermIndexer using GIN TODO\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichelp%2Fpgs2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichelp%2Fpgs2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichelp%2Fpgs2/lists"}