Git Product home page Git Product logo

geo-cn's Introduction

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

geo-cn's People

Contributors

fraserxu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.