{"id":17172909,"url":"https://github.com/20tab/leaflet-polydiff","last_synced_at":"2025-06-12T18:33:16.498Z","repository":{"id":57699428,"uuid":"451432615","full_name":"20tab/leaflet-polydiff","owner":"20tab","description":"Leaflet layer for efficient data fetching.","archived":false,"fork":false,"pushed_at":"2022-06-07T15:41:45.000Z","size":180,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-11T07:57:14.556Z","etag":null,"topics":["leaflet","leaflet-diff","leaflet-plugin","leaflet-polydiff","polygon","polygon-diff","turf"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/20tab.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-01-24T11:14:09.000Z","updated_at":"2024-04-24T08:06:21.000Z","dependencies_parsed_at":"2022-09-26T21:12:18.392Z","dependency_job_id":null,"html_url":"https://github.com/20tab/leaflet-polydiff","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/20tab/leaflet-polydiff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/20tab%2Fleaflet-polydiff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/20tab%2Fleaflet-polydiff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/20tab%2Fleaflet-polydiff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/20tab%2Fleaflet-polydiff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/20tab","download_url":"https://codeload.github.com/20tab/leaflet-polydiff/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/20tab%2Fleaflet-polydiff/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259519255,"owners_count":22870327,"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":["leaflet","leaflet-diff","leaflet-plugin","leaflet-polydiff","polygon","polygon-diff","turf"],"created_at":"2024-10-14T23:48:46.803Z","updated_at":"2025-06-12T18:33:16.458Z","avatar_url":"https://github.com/20tab.png","language":"TypeScript","readme":"# leaflet-polydiff\n\u003e Leaflet layer for efficient data fetching.\n\n`leaflet-polydiff` keeps track of user movements to compute the **difference between newly visited area in the map, and the sum of all previously visited area**, thanks to [Turf.js](https://turfjs.org).\n\nThe resulting polygon can be used to make API calls to a backend, in order to optimize data fetching of GeoJSON feature.\n\n## Installation\n\nYou can install `leaflet-polydiff` with NPM:\n\n```bash\nnpm i @20tab/leaflet-polydiff\n```\n\nOr with YARN:\n\n```bash\nyarn add @20tab/leaflet-polydiff\n```\n\n## Usage\n\n`leaflet-polydiff` is distributed as an ES2015 module, and is intended to be used with a module bundler.\n\n```typescript jsx\nimport * as L from \"leaflet\";\n\nimport PolyDiff from \"@20tab/leaflet-polydiff\";\n\n/**\n * Map initialization.\n */\nconst copy =\n    \"© \u003ca href='https://www.openstreetmap.org/copyright'\u003eOpenStreetMap\u003c/a\u003e contributors\";\nconst url = \"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\";\nconst osm = L.tileLayer(url, { attribution: copy });\n\nconst leafletMap = L.map(\"map\", {\n    layers: [osm],\n    zoom: 15,\n    center: [43.71994, 10.948968],\n});\n\n/**\n * PolyDiff activation.\n */\n\nPolyDiff().addTo(leafletMap);\n\nleafletMap.on(\"polydiff\", (event) =\u003e {\n    // The event object will carry a diff polygon.\n    event.diff;\n});\n```\n\n## Props\n\n| Name         | Type                                                                  | Default       | Description                        |\n|--------------|-----------------------------------------------------------------------|---------------|------------------------------------|\n| eventName?   | string                                                                | \"polydiff\"    | The event name for the diff event. |\n| pane?        | [LayerOptions](https://leafletjs.com/reference.html#layer-pane) | \"overlayPane\" | See link.                          |\n| attribution? | [LayerOptions](https://leafletjs.com/reference.html#layer-pane) | null          | See link.                          |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F20tab%2Fleaflet-polydiff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F20tab%2Fleaflet-polydiff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F20tab%2Fleaflet-polydiff/lists"}