Skip to content

Xuhao/china_region_data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

China region data

Chinese region data with yaml format. There levels currently: province, city, district.

Will provide other formats in the future, like: xml, sql etc.

Schema

Province

  • name: 名称
  • pinyin: 拼音
  • pinyin_abbr: 拼音缩写

City

  • name: 名称
  • pinyin: 拼音
  • pinyin_abbr: 拼音缩写
  • zip_code: 邮政编码
  • level: 等级(1:直辖市, 2:省会城市, 3:重要城市, 4:普通城市)

District

  • name: 名称
  • pinyin: 拼音
  • pinyin_abbr: 拼音缩写

Usage

First of all, download the latest yaml file from: https://github.com/Xuhao/china_region_data/raw/master/regions.yml

Ruby

require 'yaml'
regions = File.open('regions.yml') { |file| YAML.load(file) }
# => {"北京市"=>{"pinyin"=>"beijing", "pinyin_abbr"=>"bj", "cities"=> ...

Ruby on Rails

put 'gem china_region_fu' to your Gemfile:

gem 'china_region_fu'

Check out ChainRegionFu gem for more details

👬 Examples for other languages need your help! ✋

Contributing

Any corrections and improvements are welcome!

Need you help to replenish the missing data, improve the data schema and anything that make it useful for other developers.

About

Chinese region data with yaml format

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published