{"id":16731622,"url":"https://github.com/missinglink/s2js","last_synced_at":"2025-10-04T14:59:29.669Z","repository":{"id":248938733,"uuid":"829925185","full_name":"missinglink/s2js","owner":"missinglink","description":"Javascript port of the S2 Geometry library for the browser \u0026 nodejs","archived":false,"fork":false,"pushed_at":"2025-07-04T11:36:47.000Z","size":496,"stargazers_count":70,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-13T03:11:10.198Z","etag":null,"topics":["geo","geojson","geometry","javascript","point-in-polygon","s2","spherical-geometry","tesselation","typescript"],"latest_commit_sha":null,"homepage":"https://missinglink.github.io/s2js/","language":"TypeScript","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/missinglink.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":"2024-07-17T09:06:39.000Z","updated_at":"2025-07-09T10:43:23.000Z","dependencies_parsed_at":"2024-07-23T20:28:38.059Z","dependency_job_id":"a37c523d-7ca4-4642-9106-c96a1c3ee600","html_url":"https://github.com/missinglink/s2js","commit_stats":null,"previous_names":["missinglink/s2","missinglink/s2js"],"tags_count":60,"template":false,"template_full_name":null,"purl":"pkg:github/missinglink/s2js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missinglink%2Fs2js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missinglink%2Fs2js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missinglink%2Fs2js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missinglink%2Fs2js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/missinglink","download_url":"https://codeload.github.com/missinglink/s2js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/missinglink%2Fs2js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278328166,"owners_count":25968900,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["geo","geojson","geometry","javascript","point-in-polygon","s2","spherical-geometry","tesselation","typescript"],"created_at":"2024-10-12T23:38:10.754Z","updated_at":"2025-10-04T14:59:29.664Z","avatar_url":"https://github.com/missinglink.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# s2js\n\ns2js is a Javascript port of the s2 spherical geometry library.\n\n| [github](https://github.com/missinglink/s2js) | [npm](https://www.npmjs.com/package/s2js) | [documentation](https://missinglink.github.io/s2js) | [demo](https://bdon.github.io/s2js-demos/) |\n\n### Installation\n\n```bash\nnpm install s2js\n```\n\n### Usage\n\nThe library is available as both ESM \u0026 CJS modules:\n\n**ESM**\n\n```js\nimport { s2 } from 's2js'\n```\n\n**CJS**\n\n```js\nconst { s2 } = require('s2js')\n```\n\n**CDN**\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { s2 } from 'https://esm.sh/s2js'\n\u003c/script\u003e\n```\n\n### Features\n\ns2js is a full-featured JavaScript/TypeScript port of Google's S2 Geometry library. It supports:\n\n| Feature                          | Supported? | Notes |\n|----------------------------------|:---------:|:------|\n| **CellId, Cell**          | ✅        | Encoding, decoding, neighbors |\n| **Point, LatLng**          | ✅        | Spherical \u0026 Planar projections |\n| **Loop, Polygon**                    | ✅        | Polygons, potentially with holes |\n| **Polyline**                   | ✅        | Represents linear paths |\n| **RegionCoverer**                | ✅        | Cover regions (loops, polys) with S2 cells |\n| **GeoJSON \u003c\u003e S2 conversions**    | ✅        | Supports all GeoJSON geometry types |\n| **Polygon contains/intersects**  | ✅        | Point-in-polygon \u0026 shape intersection |\n| **Union, Intersection, Difference** | ✅    | Basic boolean polygon operations |\n| **BigInt cell/token conversion** | ✅        | Handles full 64-bit cell IDs |\n\n### Feature Completeness\n\nThe library is essentially feature compatible with the Golang library: https://github.com/golang/geo\n\n### Typescript Support\n\nThe library is written in Typescript and exports type definitions.\n\n### GeoJSON support\n\nThe supplementary `geojson` module provides convenience functions for working with GeoJSON data in S2:\n\n```js\nimport { geojson } from 's2js'\n\nconst s2Polyline = geojson.fromGeoJSON({\n  type: 'LineString',\n  coordinates: [\n    [102.0, 0.0],\n    [103.0, 1.0],\n    [104.0, 0.0],\n    [105.0, 1.0]\n  ]\n})\n```\n\nThe `RegionCoverer` supports all geometry types including multi-geometries:\n\n```js\nconst coverer = new geojson.RegionCoverer({ maxCells: 30 })\n\nconst union = coverer.covering({\n  type: 'Polygon',\n  coordinates: [\n    [\n      [100.0, 0.0],\n      [101.0, 0.0],\n      [101.0, 1.0],\n      [100.0, 1.0],\n      [100.0, 0.0]\n    ]\n  ]\n})\n```\n\n### Contributing\n\nIf you'd like to contribute a module please open an Issue to discuss.\n\n### Copyright\n\n© 2024 Peter Johnson \u0026lt;github:missinglink\u0026gt;\n\nThis source code is published under the Apache-2.0 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmissinglink%2Fs2js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmissinglink%2Fs2js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmissinglink%2Fs2js/lists"}