{"id":13659246,"url":"https://github.com/geodesign/spatialsankey","last_synced_at":"2025-07-24T08:09:41.645Z","repository":{"id":17451701,"uuid":"20225586","full_name":"geodesign/spatialsankey","owner":"geodesign","description":"D3 Plugin for visualizing flows on a leaflet map","archived":false,"fork":false,"pushed_at":"2018-10-10T07:45:27.000Z","size":51,"stargazers_count":51,"open_issues_count":2,"forks_count":15,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-05T22:32:46.443Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geodesign.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":"2014-05-27T15:44:58.000Z","updated_at":"2024-11-05T13:39:00.000Z","dependencies_parsed_at":"2022-09-22T19:41:01.637Z","dependency_job_id":null,"html_url":"https://github.com/geodesign/spatialsankey","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/geodesign/spatialsankey","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geodesign%2Fspatialsankey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geodesign%2Fspatialsankey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geodesign%2Fspatialsankey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geodesign%2Fspatialsankey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geodesign","download_url":"https://codeload.github.com/geodesign/spatialsankey/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geodesign%2Fspatialsankey/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266813417,"owners_count":23988544,"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-07-24T02:00:09.469Z","response_time":99,"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":[],"created_at":"2024-08-02T05:01:06.689Z","updated_at":"2025-07-24T08:09:41.624Z","avatar_url":"https://github.com/geodesign.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"Sankey diagrams on a map\n========================\nD3 Plugin for visualizing flows through a network on a leaflet map.\n\nHere is a small [example application](http://bl.ocks.org/yellowcap/03cd4a6c72f661377f7e) of the plugin.\n\nThe spatialsankey plugin is inspired by the d3-plugin [sankey](https://github.com/d3/d3-plugins/tree/master/sankey) and the the example integration of D3 elements into a leaflet map follows the [D3 + Leaflet](http://bost.ocks.org/mike/leaflet/) tutorial.\n\nTo use it, prepare a set of points as geojson and an array of link values as either csv or json. The links are defined as an array of objects with a source, target and flow value. The source and targets are the point IDs from the geojson points. Example data snippets are shown below.\n\nAfter loading the data, the links can be displayed on a leaflet map with just a few lines of code:\n\n```js\n// Instantiate spatial sankey\nvar spatialsankey = d3.spatialsankey()\n                      .lmap(map)\n                      .nodes(nodes.features)\n                      .links(links);\n\n// Draw nodes\nvar node = spatialsankey.node();\nvar circs = nodelayer.selectAll(\"circle\")\n                     .data(spatialsankey.nodes())\n                     .enter()\n                     .append(\"circle\")\n                     .attr(\"cx\", node.cx)\n                     .attr(\"cy\", node.cy)\n                     .attr(\"r\", node.r)\n                     .style(\"fill\", node.fill);\n                     \n// Draw links\nlink = spatialsankey.link();\nvar beziers = linklayer.selectAll(\"path\")\n                       .data(nodelinks);\n                       .enter()\n                       .append(\"path\")\n                       .attr(\"d\", link)\n                       .attr('id', function(d){return d.id})\n                       .style(\"stroke-width\", linke.width())\n                       .style(\"fill\", 'none');\n```\n\nnodes.geojson\n--------------------\n```js\n{\n  \"type\": \"FeatureCollection\",\n  \"features\": [\n    {\n      \"type\": \"Feature\",\n      \"id\": \"AD\",\n      \"geometry\": {\n        \"type\": \"Point\",\n        \"coordinates\": [ 1.6002, 42.5462 ]\n      }\n    },\n    {\n      \"type\": \"Feature\",\n      \"id\": \"AE\",\n      \"geometry\": {\n        \"type\": \"Point\",\n        \"coordinates\": [ 53.9791, 23.4330 ]\n      }\n    },\n    {\n      \"type\": \"Feature\",\n      \"id\": \"AF\",\n      \"geometry\": {\n        \"type\": \"Point\",\n        \"coordinates\": [ 65.5818, 33.6508 ]\n      }\n    }\n]}\n```\n\nlinks.csv\n-----------\n```\ntarget,source,flow\nAD,AE,23230\nAD,AF,371\nAF,AE,1310\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeodesign%2Fspatialsankey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeodesign%2Fspatialsankey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeodesign%2Fspatialsankey/lists"}