{"id":14509757,"url":"https://github.com/Open-S2/s2-pmtiles","last_synced_at":"2025-08-31T12:32:32.658Z","repository":{"id":241689353,"uuid":"807448176","full_name":"Open-S2/s2-pmtiles","owner":"Open-S2","description":"This library reads/writes PMTiles V3.0 as well as S2PMTiles V1.0","archived":false,"fork":false,"pushed_at":"2024-10-03T05:09:03.000Z","size":17733,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-24T20:41:05.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/Open-S2.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},"funding":{"github":"Open-S2","open_collective":"Open-S2"}},"created_at":"2024-05-29T06:01:06.000Z","updated_at":"2024-10-03T05:09:07.000Z","dependencies_parsed_at":"2024-10-30T05:27:03.277Z","dependency_job_id":null,"html_url":"https://github.com/Open-S2/s2-pmtiles","commit_stats":{"total_commits":31,"total_committers":1,"mean_commits":31.0,"dds":0.0,"last_synced_commit":"c655d1089f27cad91f8de39a440846ec8e878c6a"},"previous_names":["open-s2/s2-pmtiles"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-S2%2Fs2-pmtiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-S2%2Fs2-pmtiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-S2%2Fs2-pmtiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-S2%2Fs2-pmtiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Open-S2","download_url":"https://codeload.github.com/Open-S2/s2-pmtiles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231594818,"owners_count":18397662,"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":[],"created_at":"2024-09-03T22:00:17.043Z","updated_at":"2024-12-28T06:30:43.824Z","avatar_url":"https://github.com/Open-S2.png","language":"Rust","funding_links":["https://github.com/sponsors/Open-S2","https://opencollective.com/Open-S2"],"categories":["Watchlist"],"sub_categories":[],"readme":"\u003ch1 style=\"text-align: center;\"\u003e\n    \u003cdiv align=\"center\"\u003es2-pmtiles\u003c/div\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/actions/workflow/status/Open-S2/s2-pmtiles/test.yml?logo=github\" alt=\"GitHub Actions Workflow Status\"\u003e\n  \u003ca href=\"https://npmjs.org/package/s2-pmtiles\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/s2-pmtiles.svg?logo=npm\u0026logoColor=white\" alt=\"npm\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://crates.io/crates/s2-pmtiles\"\u003e\n    \u003cimg src=\"https://img.shields.io/crates/v/s2-pmtiles.svg?logo=rust\u0026logoColor=white\" alt=\"crate\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/s2-pmtiles\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/s2-pmtiles.svg\" alt=\"downloads\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://bundlejs.com/?q=s2-pmtiles\u0026treeshake=%5B%7B+S2PMTilesReader+%7D%5D\"\u003e\n    \u003cimg src=\"https://deno.bundlejs.com/badge?q=s2-pmtiles\u0026treeshake=[{+S2PMTilesReader+}]\" alt=\"bundle\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://open-s2.github.io/s2-pmtiles/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/docs-typescript-yellow.svg\" alt=\"docs-ts\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://docs.rs/s2-pmtiles\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/docs-rust-yellow.svg\" alt=\"docs-rust\"\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/Open-S2/s2-pmtiles/master/assets/doc-coverage.svg\" alt=\"doc-coverage\"\u003e\n  \u003ca href=\"https://coveralls.io/github/Open-S2/s2-pmtiles?branch=master\"\u003e\n    \u003cimg src=\"https://coveralls.io/repos/github/Open-S2/s2-pmtiles/badge.svg?branch=master\" alt=\"code-coverage\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://discord.opens2.com\"\u003e\n    \u003cimg src=\"https://img.shields.io/discord/953563031701426206?logo=discord\u0026logoColor=white\" alt=\"Discord\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## About\n\nA Modified TypeScript implementation of the [PMTiles](https://github.com/protomaps/PMTiles) library. It is backwards compatible but offers support for the S2 Projection.\n\n## Read The Spec\n\n[s2-pmtiles-spec](/s2-pmtiles-spec/1.0.0/README.md)\n\nFor now this spec supports deflating metadata/directories inside the browser, but it will be removed in the future.\n\n## Install\n\n```bash\n#bun\nbun add s2-pmtiles\n# pnpm\npnpm add s2-pmtiles\n# yarn\nyarn add s2-pmtiles\n# npm\nnpm install s2-pmtiles\n\n# cargo\ncargo install s2-pmtiles\n```\n\n### Example use\n\n```ts\nimport { S2PMTilesReader, S2PMTilesWriter, TileType } from 's2-pmtiles'\nimport { FileReader, FileWriter } from 's2-pmtiles/file';\n\n// The File Reader you can run on bun/node/deno\nconst testFixture1 = new S2PMTilesReader(new FileReader('test/fixtures/test_fixture_1.pmtiles'));\n// get an WM tile\nlet x = 0;\nlet y = 0;\nlet z = 0;\nlet face = 0;\ntestFixture1.getTile(x, y, z); // undefied | Uint8Array\n// get an S2 tile\ntestFixture1.getTileS2(face, x, y, z); // undefined | Uint8Array\n\n// The File Writer you can run on bun/node/deno\nconst testFixture2 = new S2PMTilesWriter(new FileWriter('tmpFile.pmtiles'), TileType.Pbf);\n// write a tile\ntestFixture2.writeTileXYZ(x, y, z, Uint8Array.from([]));\n// write an S2 tile\ntestFixture2.writeTileS2(face, x, y, z, Uint8Array.from([]));\n// when you finish you commit to build the metadata\ntestFixture2.commit();\n\n\n// The File Reader you can run in the browser\nimport { S2PMTilesReader } from 's2-pmtiles';\n// you want to add a true after the path for generic PMTiles, as it ensures 206 byte requests.\nconst browserFixture = new S2PMTilesReader('https://www.example.com/test.pmtiles', true);\n// get an WM tile\nbrowserFixture.getTile(x, y, z); // undefied | Uint8Array\n// get an S2 tile\nbrowserFixture.getTileS2(face, x, y, z); // undefined | Uint8Array\n```\n\n### Browser Support\n\nSome tsconfigs might need some extra help to see the `s2-pmtiles/file` or `s2-pmtiles/mmap` package.\n\nTo fix this update your tsconfig.json with the following:\n\n```json\n{\n    \"compilerOptions\": {\n        \"baseUrl\": \"./\",\n        \"paths\": {\n            \"s2-pmtiles/file\": [\"./node_modules/s2-pmtiles/dist/file.d.ts\"],\n            \"s2-pmtiles/mmap\": [\"./node_modules/s2-pmtiles/dist/mmap.d.ts\"]\n        }\n    }\n}\n```\n\n---\n\n## Development\n\n### Requirements\n\nYou need the tool `tarpaulin` to generate the coverage report. Install it using the following command:\n\n```bash\ncargo install cargo-tarpaulin\n```\n\nThe `bacon coverage` tool is used to generate the coverage report. To utilize the [pycobertura](https://pypi.org/project/pycobertura/) package for a prettier coverage report, install it using the following command:\n\n```bash\npip install pycobertura\n```\n\n### Running Tests\n\nTo run the tests, use the following command:\n\n```bash\n# TYPESCRIPT\n## basic test\nbun run test\n## live testing\nbun run test:dev\n\n# RUST\n## basic test\ncargo test\n# live testing\nbacon test\n```\n\n### Generating Coverage Report\n\nTo generate the coverage report, use the following command:\n\n```bash\ncargo tarpaulin\n# bacon\nbacon coverage # or type `l` inside the tool\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOpen-S2%2Fs2-pmtiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOpen-S2%2Fs2-pmtiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOpen-S2%2Fs2-pmtiles/lists"}