{"id":21252601,"url":"https://github.com/lin-123/leaflet.migration","last_synced_at":"2025-08-17T14:32:55.277Z","repository":{"id":34560649,"uuid":"180344869","full_name":"lin-123/leaflet.migration","owner":"lin-123","description":"leaflet plugin that provides migration layer. https://lin-123.github.io/leaflet.migration/","archived":false,"fork":false,"pushed_at":"2024-06-19T17:16:12.000Z","size":6567,"stargazers_count":29,"open_issues_count":4,"forks_count":15,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-04T04:50:20.481Z","etag":null,"topics":["fly-line","flyline","leaflet-plugins","migration"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lin-123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-04-09T10:42:00.000Z","updated_at":"2024-09-06T08:18:39.000Z","dependencies_parsed_at":"2024-05-06T08:29:46.922Z","dependency_job_id":"24618915-24ed-4e48-9632-7612ec608243","html_url":"https://github.com/lin-123/leaflet.migration","commit_stats":{"total_commits":90,"total_committers":6,"mean_commits":15.0,"dds":0.1333333333333333,"last_synced_commit":"19942c098ac204b199c94d0d5621f9492143ab0f"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lin-123%2Fleaflet.migration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lin-123%2Fleaflet.migration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lin-123%2Fleaflet.migration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lin-123%2Fleaflet.migration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lin-123","download_url":"https://codeload.github.com/lin-123/leaflet.migration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230136132,"owners_count":18178812,"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":["fly-line","flyline","leaflet-plugins","migration"],"created_at":"2024-11-21T03:48:04.289Z","updated_at":"2024-12-17T15:09:50.488Z","avatar_url":"https://github.com/lin-123.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# leaflet.migration\n\nleaflet plugin that provides migration lines layer.\n\n\u003c!-- ![alt text](public/example.jpg) --\u003e\n\u003cimage src=\"./assets/leaflet.migration-demo.gif\"\u003e\n\n## Installation\n\n```\nnpm install -S leaflet.migration\n```\n\n## [Demo](https://lin-123.github.io/leaflet.migration/)\n\n```javascript\nimport L from 'leaflet';\nimport 'leaflet/dist/leaflet.css';\nimport 'leflet.migration';\nconst data = [\n  {\n    labels: ['from', 'to'],\n    from: [lat, lng],\n    to: [lat, lng],\n    color: '',\n    value: '',\n  },\n];\nconst popover = document.querySelector('.popover');\nconst options = {\n  marker: {\n    radius: [5, 10],\n    pulse: true,\n    textVisible: true\n  },\n  line: {\n    width: 1,\n    order: false,\n    icon: {\n      type: 'arrow',\n      imgUrl: '',\n      size: 20\n    },\n  },\n  // marker: 'https://github.githubassets.com/favicons/favicon.png',\n  replacePopover(x, y, data, index) {\n    console.log(x, y, data, index, 'replace popover');\n    popover.innerHTML =\n      'value:' + data.value + '\\nfrom:' + data.labels[1] + '\\nto:' + data.labels[0];\n    return popover;\n  },\n  onShowPopover(data, index) {\n    console.log(data, index, 'show popover');\n  },\n  onHidePopover(data) {\n    console.log('hide popover', data);\n  },\n};\nconst migrationLayer = L.migrationLayer(data, options);\nmigrationLayer.setStyle({ pulse: { radius: 20 } });\nmigrationLayer.setData([]);\nmap.remove(migrationLayer);\n```\n\n\n## API\n\n\n### Data\n\n| type                | description         |\n| ------------------- | ------------------- |\n| `[\u003cMigrationData\u003e]` | migration data list |\n\nMigrationData\n\n| name | type                          | description                     |\n| --------- | ----------------------------- | ------------------------------- |\n| labels    | `[\u003cstring\u003efrom, \u003cstring\u003e to]` | label                           |\n| from      | `[\u003cnumber\u003elat, \u003cnumber\u003elng]`  | from label latlng               |\n| to      | `[\u003cnumber\u003elat, \u003cnumber\u003elng]`  | to label latlng                 |\n| color     | string                        | the color of each arc and pulse |\n| value     | number                        | intense value of migration line |\n\n### Options\n\n| name    | type    | default      | description                                  |\n| --------- | ------- | ------------ | -------------------------------------------- |\n| marker    | MarkerOption | - | marker style |\n| line    | LineOption | - | line style |\n| minZoom | number | 3 | migration layer display when zoom \u003e= 3 |\n|replacePopover|(`\u003cpixel\u003ex`, `\u003cpixel\u003ey`, `\u003cMigrationData\u003edata`, `\u003cinteger\u003eindex`) =\u003e Element | - |replace default popover by return element |\n|onShowPopover|(`\u003cMigrationData\u003edata`, `\u003cinteger\u003eindex`) =\u003e void | - | called on mouse hover pulse |\n| onHidePopover|(`\u003cinteger\u003eindex`) =\u003e void | none | called on mouse leave pulse |\n\nMarkerOption\n\n| name | type                          | default |description                     |\n| --------- | -----------------------------| --- | ------------------------------- |\n| radius    | `[\u003cnumber\u003emin, \u003cnumber\u003e max]`| [5, 10] | marker size range, measure by MigrationData.value |\n| pulse | boolean | true | marker's ring animation |\n| textVisible | boolean | false | whether marker label |\n\nLineOption\n| name | type | default | description |\n| ---- | ---- | ------- | ----------- |\n| width | number | 1 | migration line width |\n| order | boolean | false | whether the sweep run in sequence |\n| icon | LineIcon | { type: 'circle', size: 20 } | sweep header style |\n\nLineIcon\n\n| name | type | default | description |\n| ---- | ---- | ------- | ----------- |\n| type | `circle|arrow|img` | circle | icon type |\n| imgUrl | string | - | Image url when type is img |\n| size | number | 20 | icon size |\n\n### Methods\n\n| method                       | returns | descrition                     |\n| ---------------------------- | ------- | ------------------------------ |\n| setData(`[\u003cMigrationData\u003e]`) | this    | update migration data          |\n| setStyle(options)            | this    | update style                   |\n| show()                       | this    | show layer                     |\n| hide()                       | this    | hide layer                     |\n| play()                       | this    | run animate of arc and pulse   |\n| pause()                      | this    | pause animate of arc and pulse |\n\nMethods inherited from [L.Layer](https://leafletjs.com/reference-1.5.0.html#layer)\n\n| method                | returns | descrition                                         |\n| --------------------- | ------- | -------------------------------------------------- |\n| onAdd(`\u003cMap\u003e map`)    | this    | called on L.migrationLayer(data, style).addTo(map) |\n| onRemove(`\u003cMap\u003e map`) | this    | called on map.remove(migrationLayer)               |\n\n\n## Requirements\n\n- leaflet ^1.8.0\n- node ^14.17.3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flin-123%2Fleaflet.migration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flin-123%2Fleaflet.migration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flin-123%2Fleaflet.migration/lists"}