This repository conatin the following file:
- cn.json - shape files + places data
- places.json - Major cites in China
- subunits.json - China cartographic boundaries
See preview here: https://github.com/fraserxu/geo-cn/blob/master/datas/cn.json
I wanted to build a map with d3.js, and I followed up this post Let’s Make a Map. But after get started, I finded it hard to get the needed map data for me, especially for a country like China.
In the post Mike provided lots of good resources to find geographic data, here I just took a step way further and prepared the target data for me to use.
The source data is converted from Natural Earth.
You can download the complete file from Admin 0 - Details - map subunits
-
gdal(Geospatial Data Abstraction Library)
brew install gdal
-
topjson(TopoJSON)
npm install -g topjson
-
create
subunits.json
GeoJSON file(here including Hongkong, Taiwan and Macau):ogr2ogr \ -f GeoJSON \ -where "ADM0_A3 IN ('CHN', 'HKG', 'TWN', 'MAC')" \ subunits.json \ ne_10m_admin_0_map_subunits.shp
-
create
places.json
GeoJSON fileogr2ogr \ -f GeoJSON \ -where "ISO_A2 IN ('CN', 'HK', 'TW', 'MO') AND SCALERANK < 8" \ places.json \ ne_10m_populated_places.shp
-
generate
cn.json
filetopojson \ -o cn.json \ --id-property SU_A3 \ --properties name=NAME \ -- \ subunits.json \ places.json
MIT