{"id":16742330,"url":"https://github.com/clemsos/d3-china-map","last_synced_at":"2025-04-13T09:40:53.579Z","repository":{"id":15413702,"uuid":"18145826","full_name":"clemsos/d3-china-map","owner":"clemsos","description":"A template to create map of China by province using d3js","archived":false,"fork":false,"pushed_at":"2018-06-18T18:51:14.000Z","size":293,"stargazers_count":241,"open_issues_count":0,"forks_count":100,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-03-27T01:11:14.497Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/clemsos.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}},"created_at":"2014-03-26T16:52:48.000Z","updated_at":"2025-01-04T18:14:34.000Z","dependencies_parsed_at":"2022-08-30T14:11:25.842Z","dependency_job_id":null,"html_url":"https://github.com/clemsos/d3-china-map","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemsos%2Fd3-china-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemsos%2Fd3-china-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemsos%2Fd3-china-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemsos%2Fd3-china-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clemsos","download_url":"https://codeload.github.com/clemsos/d3-china-map/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248693288,"owners_count":21146769,"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-10-13T01:23:23.807Z","updated_at":"2025-04-13T09:40:53.557Z","avatar_url":"https://github.com/clemsos.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  China map template using d3.js\n\nThis is a template to easily create nice map of China using data by provinces with d3js. The map includes Taiwan, HK and Macau.\n\n## Add your data\n\nTo generate a map, you can use the small Python script called ```create_d3_map.py``` or pass your values to js variables directly within the html file.\n\n### Per province\n\nYou need to parse you data into a 2D array where  each province is associated to a count (int or float).\n\n    var data=[ [\"Guangdong\",12], [\"Guizhou\", 15] ...]\n\nAvailable provinces are :\n\n    [\"Gansu\", \"Qinghai\", \"Guangxi\", \"Guizhou\", \"Chongqing\", \"Beijing\", \"Fujian\", \"Anhui\", \"Guangdong\", \"Xizang\", \"Xinjiang\", \"Hainan\", \"Ningxia\", \"Shaanxi\", \"Shanxi\", \"Hubei\", \"Hunan\", \"Sichuan\", \"Yunnan\", \"Hebei\", \"Henan\", \"Liaoning\", \"Shandong\", \"Tianjin\", \"Jiangxi\", \"Jiangsu\", \"Shanghai\", \"Zhejiang\", \"Jilin\", \"Inner Mongol\", \"Heilongjiang\", \"Taiwan\", \"Xianggang\", \"Macau\"]\n\n\n### Colors\n\nColors scope is defined in the ```colorScale``` function in d3map.js\n\n### Title, description, units and credits\n\nAdditional info should be added like this :\n\n    var title='Population of Sina Weibo users for a specific keyword';\n    var desc='Based on Sina Weibo user profiles during a period of time. Data from weiboscope.';\n    var credits='by Clement Renaud - 2013';\n    var units='Volume of tweets';\n\n\n## Notes\n\n### Map data\nTo map data about China, we need to combine several maps to include HK, Aomen and Taiwan. \n\nMap data has been prepared on Mike Bostock's d3js [map tutorial](http://bost.ocks.org/mike/map/) and [this other tutorial](http://www.tnoda.com/blog/2013-12-07)\n\n* http://bl.ocks.org/mbostock/4707858\n* http://ccarpenterg.github.io/blog/us-census-visualization-with-d3js/\n\n\nMap data map need to be downloaded from [Natural Earth](www.naturalearthdata.com) 1:10m Cultural Vectors \n\n* Admin 0 - Countries (including taiwan and HK)  [Download](http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries_lakes.zip)\n* Admin 1 - States, Provinces (only the mainland) [Download](http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_1_states_provinces_lakes.zip)\n\nThen, we use command-line tool ```ogr2ogr``` to filter SHP and keep only relevant part of the map and convert to geojson.\n\nFor the countries, we use ISO 3166-1 alpha-3 standard names of the countries : 'CHN', 'HKG', 'TWN' and 'MAC' to generate 2 maps : PRC+Taiwan borders, Aomen+HK borders\n \n    ogr2ogr -f GeoJSON -where \"ADM0_A3 IN ('CHN','TWN')\" zh-chn-twn.topo.json ne_10m_admin_0_countries_lakes.shp\n\n    ogr2ogr -f GeoJSON -where \"ADM0_A3 IN ('HKG','MAC')\" zh-hkg-mac.geo.json ne_10m_admin_0_countries_lakes.shp\n\nFor the provinces, we need only the mainland.\n    \n    ogr2ogr -f GeoJSON -where \"gu_A3 IN ('CHN')\" zh-mainland-provinces.json ne_10m_admin_1_states_provinces_lakes.shp \n\nThe we use mapshaper.org to simplify the geometry (make the file smaller) and download it as topojson. Final states of the files are available in this rep. \n\nTODO : Make the maps files smaller using npm topojson and removing useless fields","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclemsos%2Fd3-china-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclemsos%2Fd3-china-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclemsos%2Fd3-china-map/lists"}