{"id":19560117,"url":"https://github.com/plotdb/pdmaptw","last_synced_at":"2026-06-10T13:31:47.336Z","repository":{"id":42527606,"uuid":"232936480","full_name":"plotdb/pdmaptw","owner":"plotdb","description":"台灣 ( \"中華民國自由地區\"，含台、澎、金、馬 ) 縣市、鄉鎮、村里界圖。含前端繪圖函式 ( 基於 d3.js v4 )","archived":false,"fork":false,"pushed_at":"2023-04-03T13:38:06.000Z","size":89943,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-03T20:16:00.173Z","etag":null,"topics":["d3js","map","taiwan"],"latest_commit_sha":null,"homepage":"http://plotdb.github.io/pdmap.tw","language":"JavaScript","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/plotdb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-01-10T01:01:39.000Z","updated_at":"2022-09-03T14:52:08.000Z","dependencies_parsed_at":"2025-02-26T08:40:35.120Z","dependency_job_id":null,"html_url":"https://github.com/plotdb/pdmaptw","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/plotdb/pdmaptw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotdb%2Fpdmaptw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotdb%2Fpdmaptw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotdb%2Fpdmaptw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotdb%2Fpdmaptw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plotdb","download_url":"https://codeload.github.com/plotdb/pdmaptw/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotdb%2Fpdmaptw/sbom","scorecard":{"id":738023,"data":{"date":"2025-08-11","repo":{"name":"github.com/plotdb/pdmaptw","commit":"5704ec329fc92f92e0fe895b4f40a8dbe3caa6f9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.2,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v2.2.1 not signed: https://api.github.com/repos/plotdb/pdmaptw/releases/97855037","Warn: release artifact v2.2.0 not signed: https://api.github.com/repos/plotdb/pdmaptw/releases/97761195","Warn: release artifact v2.1.1 not signed: https://api.github.com/repos/plotdb/pdmaptw/releases/79018581","Warn: release artifact v2.1.0 not signed: https://api.github.com/repos/plotdb/pdmaptw/releases/77420598","Warn: release artifact v2.0.1 not signed: https://api.github.com/repos/plotdb/pdmaptw/releases/72422175","Warn: release artifact v2.2.1 does not have provenance: https://api.github.com/repos/plotdb/pdmaptw/releases/97855037","Warn: release artifact v2.2.0 does not have provenance: https://api.github.com/repos/plotdb/pdmaptw/releases/97761195","Warn: release artifact v2.1.1 does not have provenance: https://api.github.com/repos/plotdb/pdmaptw/releases/79018581","Warn: release artifact v2.1.0 does not have provenance: https://api.github.com/repos/plotdb/pdmaptw/releases/77420598","Warn: release artifact v2.0.1 does not have provenance: https://api.github.com/repos/plotdb/pdmaptw/releases/72422175"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Vulnerabilities","score":0,"reason":"29 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-3965-hpx2-q597","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-36jr-mh4h-2g58","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}}]},"last_synced_at":"2025-08-22T16:29:04.168Z","repository_id":42527606,"created_at":"2025-08-22T16:29:04.168Z","updated_at":"2025-08-22T16:29:04.168Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34155422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"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":["d3js","map","taiwan"],"created_at":"2024-11-11T05:06:05.014Z","updated_at":"2026-06-10T13:31:47.316Z","avatar_url":"https://github.com/plotdb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pdmaptw\n\n台灣 ( \"中華民國自由地區\"，含台、澎、金、馬 ) 縣市、鄉鎮、村里界圖。含前端繪圖函式 ( 基於 d3.js v4 )\n\n\n## Installation\n\n  npm install --save pdmaptw\n\n\n## Frontend Usage\n\n`pdmaptw` depends on following libraries:\n\n - d3@^4.0.0\n - topojson@^2.0.0\n - d3-geo@^1.0.0\n - d3-geo-projection@^2.0.0\n\ninclude dependencies:\n\n    \u003cscript src=\"https://d3js.org/d3.v4.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"https://d3js.org/topojson.v2.min.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"https://d3js.org/d3-color.v1.min.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"https://d3js.org/d3-interpolate.v1.min.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"https://d3js.org/d3-scale-chromatic.v1.min.js\"\u003e\u003c/script\u003e\n\ninclude main js file:\n\n    \u003cscript src=\"path/to/dist/index.js\u003e\"\u003e\u003c/script\u003e\n\ninclude corresponding map files:\n\n    \u003cscript src=\"path/to/dist/county.map.js\u003e\"\u003e\u003c/script\u003e\n    \u003cscript src=\"path/to/dist/town.map.js\u003e\"\u003e\u003c/script\u003e\n    \u003cscript src=\"path/to/dist/village.map.js\u003e\"\u003e\u003c/script\u003e\n\n\nThen, create map object:\n\n    var obj = new pdmaptw(opt);\n    obj.init().then(function() {\n      obj.fit();\n    });\n\n\n## Constructor Options\n\n - `root`: container for this map\n - `type: 'county', 'town' or 'village'.\n\n\n## API\n\n - `init()`: map initialization, include data fetching / path elements creating. return promise.\n - `fit(opt)`: fit map to the size of container. options:\n   - `box`: bounding box `{width, height}` for fix size hinting \n\n\n## Events\n\n - `hover`: fired when user hovers on geographic paths. with parameters:\n   - evt: event for mouseover.\n   - data: not null if mouseover path element of map. usually a topojson object with `properties` member:\n     - properties.name - name for this geographic block, like \"高雄市左營區\"\n\n\n## Class Methods\n\n - `projection()`: return a d3js GeoProjection for 台澎金馬地區, as compact as possible.\n   - the returned function accepts parameters as an array with `[lng, lat]` format.\n - `normalize(str)` - name normalization, e.g., replace '臺' with '台'.\n\n\n## Building Map File\n\nAfter `npm install`, Fetch data and build:\n\n    npm run build\n\nAlternatively, execute the script manually:\n\n    ./fetch\n    ./node_modules/.bin/lsc convert.ls\n    ./node_modules/.bin/lsc filter.ls\n    ./build\n\nWhat the above commands do:\n\n - `fetch` will download and unzip shp files from government website to download folder.\n - `convert.ls` will process all shp files and convert them to topojson.\n   - tweak `mw` and `w` for twaking topojson size. be sure to test in major browsers before using.\n     escpecially windows firefox since we encountered an abnormal path before.\n - `filter.ls` will generate separated county files.\n - `build` build the utility js `twmap` for frontend rendering.\n - `tool/build.sh` will process all shp files and convert them to geojson, topojson and sample svg.\n   - for getting topojson, simply use `convert.ls` directly.\n\n\n## Demonstration\n\nFor a sample usage in frontend:\n\n    npm start\n\nthe script will start a simple server and open the demo page automatically.\n\n\n\n## meta.json structure\n\nfor keeping topojson metadata. lookup with cid/tid/vcode.\n\n   {\n     county: {\n      \"county-id\": {c: \"county-code\", n: \"county-name\"}, ...\n     },\n     town: {\n      \"town-id\": {c: \"town-code\", n: \"town-name\"}, ...\n     },\n     village: {\n      \"village-code\": {n: \"village-name\"}, ...\n     }\n   }\n\nproperties in topojson is then converted to: \n\n    { cid: \"county-id\", tid: \"town-id\", vcode: \"village-code\" }\n\neach field exists only when applicable.\n\n\n## 詳細產製流程\n\n * 取得 shp files. \n   - 可以從政府開放資料平台取得. e.g., \n     - 縣市: https://data.gov.tw/dataset/7442\n     - 鄉鎮: https://data.gov.tw/dataset/7441\n     - 村里: https://data.gov.tw/dataset/7438\n * shp to geojson\n   - 使用 npm module: shapefile\n     - npm install shapefile\n     - shp2json \u003cshp-file\u003e ( -o \u003cjson\u003e )\n   * ( geojson 的格式說明? )\n   - 轉出的geojson 仍需做投影, 而這可以先做, 就不用 runtime 做. 使用 d3-geo-projection\n     - npm install d3-geo-projection\n     - geoproject 'd3.geoConicEqualArea().parallels([34, 40.5]).rotate([120, 0]).fitSize([960, 960], d)' \\\n       \u003c \u003cgeojson\u003e \\\n       \u003e \u003cgeojson\u003e\n     - geoConicEqualArea 適用於北美加州, 我們可以自已換投影法. 參考\n       - https://github.com/d3/d3-geo-projection/blob/master/README.md\n     - 可以用 geo2svg ( from d3-geo-projection ) 先輸出範本 svg ( 但大概會非常大 ):\n       - geo2svg -w 960 -h 960 \u003c \u003cgeojson\u003e \u003e \u003csvg\u003e\n   - Data Join: 利用 ndjson 將 geojson 分 features 切成很多行, 方便後續處理\n     - npm install ndjson\n     - 切開: ndjson-split 'd.features' \u003c \u003cgeojson\u003e \u003e \u003cnd-geojson\u003e\n     - 轉換: ndjson-map 'd.id = d.properties.GEOID.slice(2), d' \u003c \u003cnd-geojson\u003e \u003e \u003cnd-alt-geojson\u003e\n     - 串接: ndjson-cat \u003cnd-alt-geojson\u003e ...\n     - join data: ndjson-join ...\n     - 轉回 geojson: ndjson-reduce\n   - 最佳化: 使用 topojson 格式.\n     - npm install topojson\n     - geo2topo -n tracts=\u003cgeojson\u003e \u003e \u003ctopojson\u003e\n     - toposimplify -p 1 -f  \u003c \u003ctopojson\u003e \u003e \u003ctopojson2\u003e\n     - topoquantize 1e5 \u003c \u003ctopojson2\u003e \u003e \u003ctopojson3\u003e\n   - 合併行政區塊: 使用 topomerge ( in topojson package )\n     - topomerge -k 'd.id.slice(0,3)' counties=tracts \u003c \u003ctopojson3\u003e \u003e \u003ctopojson4\u003e\n\n * geojson to topojson\n\n\n## License\n\nSource code: MIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplotdb%2Fpdmaptw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplotdb%2Fpdmaptw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplotdb%2Fpdmaptw/lists"}