Skip to content

vorbei/geo-cn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

geo-cn

What?

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

Why?

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

Tooling

Converting Data

  • 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 file

    ogr2ogr \
      -f GeoJSON \
      -where "ISO_A2 IN ('CN', 'HK', 'TW', 'MO') AND SCALERANK < 8" \
      places.json \
      ne_10m_populated_places.shp
    
  • generate cn.json file

    topojson \
      -o cn.json \
      --id-property SU_A3 \
      --properties name=NAME \
      -- \
      subunits.json \
      places.json
    

license

MIT

About

China GeoJSON data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published