Chinese region data with yaml format. There levels currently: province, city, district.
Will provide other formats in the future, like: xml, sql etc.
name
: 名称pinyin
: 拼音pinyin_abbr
: 拼音缩写
name
: 名称pinyin
: 拼音pinyin_abbr
: 拼音缩写zip_code
: 邮政编码level
: 等级(1:直辖市, 2:省会城市, 3:重要城市, 4:普通城市)
name
: 名称pinyin
: 拼音pinyin_abbr
: 拼音缩写
First of all, download the latest yaml file from: https://github.com/Xuhao/china_region_data/raw/master/regions.yml
require 'yaml'
regions = File.open('regions.yml') { |file| YAML.load(file) }
# => {"北京市"=>{"pinyin"=>"beijing", "pinyin_abbr"=>"bj", "cities"=> ...
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! ✋
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.