Giter VIP home page Giter VIP logo

china_division's Introduction

**行政区划

介绍

最新**行政区划,数据发布时间:2017-03-10。 数据来源:http://www.stats.gov.cn/tjsj/tjbz/xzqhdm/201703/t20170310_1471429.html

安装

go get -v gopkg.in/tugoers/china_division.v0

Note: 如果**大陆地区用户出现 golang.org/x/net 包不能下载的情况,可选择从 GitHub 下载(go get -v github.com/golang/net), 然后将 $GOPATH/src/github.com/golang/net 目录复制到 $GOPATH/src/golang.org/x/net 目录下。

示例

cmd.go:

package main

import (
	"gopkg.in/tugoers/china_division.v0"
	"fmt"
)

func main() {
	// 获取所有省级名称及省级代码
	provinces := china_division.GetProvinces()

	for _, province := range provinces {
		// 省级代码
		provinceCode := province[0]
		// 省级名称
		provinceName := province[1]

		fmt.Println("┝", provinceName)

		// 根据省级代码获取市级名称及市级代码
		cities := china_division.GetCities(provinceCode)
		for _, city := range cities {
			// 市级代码
			cityCode := city[0]
			// 市级名称
			cityName := city[1]
			fmt.Println("│ ┝", cityName)

			// 根据市级代码获取区县级名称及区县级代码
			counties := china_division.GetCounties(cityCode)
			for _, county := range counties {
				countyCode := county[0]
				countyName := county[1]
				fmt.Println("│ │ ┝", countyCode, ":", countyName)
			}
		}
	}
}

更多示例参考 example

License

Released under the MIT License.

china_division's People

Contributors

morgine avatar

Watchers

 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.