Bigkoo / Bigkoo/Android-PickerView

更新 province.json 的操作方法,获取到最新版的省市区数据

Open
#1,030 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
13.4k
Forks
3.4k
PR merge metrics
No merged PRs in 30d

Description

鉴于 assets/province.json 于2017年之后就没有更新,导致选择器的行政区划数据过于滞后,很多新的区县都没有。每年都会有十几到几十个区县撤并,因此行政区划数据应当需要经常更新维护。

可以到我的开源库:https://github.com/xiangyuecn/AreaCity-JsSpider-StatsGov 获取到最新的省市区数据,基本上月更,除了省市区乡镇四级区划外,还有坐标边界数据。

## 转成 province.json ,请用下面方法(使用时,建议开发当天转换得到新文件,这样就能使用到最新版本数据):

1. 打开在线多级联动生成页面:https://xiangyuecn.github.io/AreaCity-JsSpider-StatsGov/
2. 拖动页面到最底下,在“导出为自定义按钮”上方的输入框中填写下面的`自定义js代码`
3. 点击“导出为自定义按钮”,就得到了含最新数据的 province.json 文件

> 注意:生成的文件带了UTF8的BOM头,可以把文件打开后,复制一下文本到新的文件里面,去掉BOM头,免得对json解析产生影响

**自定义js代码:**
``` javascript
//复制这些代码到 “导出为自定义按钮” 上方的输入框中
function UserFormat(list,mapping){
var exec=function(level,obj,dist){//写个函数,递归处理数据
if(!obj.childs.length){
return;
};
for(var i=0;i

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with assets/province.json and inspect how the Android picker consumes its province, city, and area structure. Use the linked AreaCity-JsSpider-StatsGov page and the provided UserFormat function to generate current data, then replace the asset after removing the UTF-8 BOM. Done means the JSON parses and retains the expected three-level structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, javascript
Domain
data, mobile
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.