• Stars
    star
    124
  • Rank 279,321 (Top 6 %)
  • Language
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

中国五级行政区域坐标

中国五级行政区域坐标

数据来源

数据来自 china_area_mysql,包括省市县镇村 5 个层级(港澳地区的数据只有 3 级,台湾地区 4 级),数据被处理成 json 和 txt 两种格式类型。

pyecharts 自定义坐标

pyecharts 中,Geo/Geolines 图需要定义地区坐标,由于全国地区众多且多重名,pyecharts 无法精确度较高的区域坐标。pyecharts 中提供自定义坐标的方式有 4 种:

  1. (推荐) 使用 geo_cities_coords 参数,字典类型,如 {'阿城': [126.58, 45.32],}

    coords.txt

    "北京": [116.407526, 39.90403],
    "北京东城": [116.416357, 39.928353],
    "北京东城东华门": [116.406708, 39.914219],
    "北京东城东华门多福巷": [116.412747, 39.923014],
    "北京东城东华门银闸": [116.406708, 39.914219],
    "北京东城东华门东厂": [116.406708, 39.914219],
    "北京东城东华门智德": [116.404642, 39.918634],
    "北京东城东华门南池子": [116.40318, 39.907837],
    "北京东城东华门黄图岗": [116.410022, 39.920854],
    "北京东城东华门灯市口": [116.414391, 39.918751],
    

    在 coords.txt 中查找对应关键字,复制到 geo_cities_coords 参数即可

  2. (推荐) 使用 add_coordinate() 方法提供一个自定义坐标

    本质上 geo_cities_coords 内部就是调用 add_coordinate() 方法

    add_coordinate(self, name: six.text_type, longitude: float, latitude: float): -> None
    
    example:
        add_coordinate("某地", 100.0, 20.0)
    
  3. (推荐 V0.5.9+) 使用 add_coordinate_json() 方法提供一个自定义坐标 JSON 文件

    add_coordinate_json(self, json_file: six.text_type): -> None
    
    example:
        add_coordinate_json("my_coords.json")
    
    # my_coords.json
    {
        "某地": [100.0, 20.0],
        ...
    }
    
  4. (不推荐,这种操作方式一旦 pyecharts 更新,坐标会失效) Hack pyecharts 源代码,对应文件位于 Lib/site-packages/pyecharts/datasets/city_coordinates.json 具体路径根据操作系统和 Python 环境而定。

    coords.json

    [
        {"北京": [116.407526, 39.90403]},
        {"北京东城": [116.416357, 39.928353]},
        {"北京东城东华门": [116.406708, 39.914219]},
        {"北京东城东华门多福巷": [116.412747, 39.923014]},
        {"北京东城东华门银闸": [116.406708, 39.914219]},
        {"北京东城东华门东厂": [116.406708, 39.914219]},
        {"北京东城东华门智德": [116.404642, 39.918634]},
        {"北京东城东华门南池子": [116.40318, 39.907837]},
        {"北京东城东华门黄图岗": [116.410022, 39.920854]},
        {"北京东城东华门灯市口": [116.414391, 39.918751]},
        ...
    ]
    

    在 coords.json 中查找对应关键字,补充到 city_coordinates.json 文件中即可

License

MIT ©chenjiandongx

More Repositories

1

pyecharts

🎨 Python Echarts Plotting Library
Python
14,453
star
2

pyecharts-gallery

Just use pyecharts to imitate Echarts official example.
HTML
1,080
star
3

pyecharts-app

pyecharts 体验网站(已弃用)
Python
186
star
4

pyecharts-snapshot

renders the output of pyecharts as png, jpeg, gif, svg, eps, pdf and raw base64
Python
173
star
5

pyecharts-users-cases

pyecharts 示例文件
119
star
6

pyecharts-assets

🗂 All assets in pyecharts
JavaScript
93
star
7

jupyter-echarts

Bring echarts libraries to jupyter notebooks
JavaScript
84
star
8

website

pyecharts.org source
JavaScript
27
star
9

assets

All javascript assets known in pyecharts. Made with ❤️ for django and Flask developers
HTML
26
star
10

snapshot-selenium

Render pyecharts as image via selenium
Python
23
star
11

snapshot-pyppeteer

Render pyecharts as image via pyppeteer
Python
15
star
12

pyecharts-javascripthon

Embeded Python functions in pyecharts
Python
13
star
13

snapshot-phantomjs

Render pyecharts as image via phantomjs
Python
13
star
14

echarts-themes-js

echarts vintage, macarons, infographic, shine, roma themes
JavaScript
8
star
15

echarts-themes-pypkg

packages echarts vintage, macarons, infographic, shine, roma themes
Python
4
star
16

pyecharts-extras

Draw specialised charts using pyecharts
Python
4
star
17

geopython-2019-talk

Jupyter notebooks for geopython 2019
Jupyter Notebook
4
star
18

jupyter-echarts-pypkg

Echarts pypi packages for jupyter and python
Python
4
star
19

articles

👌 articles about pyecharts
HTML
3
star
20

pyecharts-jupyter-installer

Install pyecharts extensions into jupyter
Python
2
star
21

vendor

😉articles stroage
JavaScript
1
star
22

05x-docs

pyecharts 0.5.x docs
HTML
1
star
23

pyecharts-javascripthon-api-service

Bring pyecharts-javascripthon to python 2.7 and 3.4 users
Python
1
star