# -*- coding:utf-8 -*-
import random
import config
import json
import os
geojson_suffix = '.geojson'
json_suffix = '.json'
def parse_geojson_to_json(input, output):
data = config.read_config(input, '')
result = []
features = data["features"]
for node in features:
result_node = {}
properties = node["properties"]
result_node["name"] = properties["name"]
result_node["value"] = properties["cp"]
result.append(result_node)
config.write_config(output, result)
def parse_geojson_to_json_1(input, output, startValue, endValue):
data = config.read_config(input, '')
result = []
features = data["features"]
for node in features:
result_node = {}
properties = node["properties"]
result_node["name"] = properties["name"]
result_node["value"] = random.randint(startValue, endValue)
result.append(result_node)
config.write_config(output, result)
def parse_geojson_to_json_2(input, output, startValue, endValue):
data = config.read_config(input, '')
result = []
try:
features = data["features"]
for node in features:
result_node = {}
properties = node["properties"]
try:
result_node["name"] = properties["name"]
result_node["value"] = [properties["cp"][0], properties["cp"][1], random.randint(startValue, endValue)]
result.append(result_node)
except Exception as e:
pass
config.write_config(output, result)
except Exception as e:
print("exception: %s %s" % input, e.args)
def parse_geojson_to_json_3(input, output, startValue, endValue):
data = config.read_config(input, '')
result = []
try:
features = data["features"]
for node in features:
result_node = {}
properties = node["properties"]
try:
result_node["name"] = properties["name"]
result_node["value"] = [properties["cp"][0], properties["cp"][1], random.randint(startValue, endValue)]
except Exception as e:
coordinatesValue = node["geometry"]["coordinates"][0][0]
coordLen = len(coordinatesValue)
randomKey = random.randint(0, coordLen)
result_node["value"] = [coordinatesValue[randomKey][0], coordinatesValue[randomKey][1], random.randint(startValue, endValue)]
result.append(result_node)
config.write_config(output, result)
except Exception as e:
print("exception: %s" % input)
def traverse_dir():
input_path = './geojson/shape-with-internal-borders'
output_path = 'json/'
file_list = os.listdir(input_path)
for node in file_list:
filename = node.split(".")[0] + json_suffix
inputfile = os.path.join(input_path, node)
outfile = os.path.join(output_path, filename)
parse_geojson_to_json_2(inputfile, outfile, 100, 500)
if __name__ == "__main__":
input_path = 'geojson/shape-with-internal-borders/'
output_path = 'json/neimenggu/'
filename = 'nei4_meng2_gu3_xi2_lin2_guo1_le4_meng2'
inputfile = input_path + filename + '.geojson'
outputfile = output_path + filename + '.json'
# parse_geojson_to_json(input, output)
# parse_geojson_to_json_1(input, output_1, 100, 500)
parse_geojson_to_json_2(inputfile, outputfile, 100, 500)
# traverse_dir()
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
1、Echarts ,Python 实现的地图 视觉映射图,散点(气泡)图。 2、包括地图坐标经纬度geoJSON数据。 3、详细手册参考我的博文: https://blog.csdn.net/lildkdkdkjf/article/details/120139160 4、技术支持QQ微信同号: 6550523,欢迎来撩~
资源推荐
资源详情
资源评论
收起资源包目录
【源码】数据可视化:基于Echarts + GeoJson实现的地图视觉映射散点(气泡)组件【3】 - 甘肃省.zip (52个子文件)
【源码】数据可视化:基于Echarts + GeoJson实现的地图视觉映射散点(气泡)组件【3】 - 甘肃省
httpserver.py 2KB
__pycache__
config.cpython-39.pyc 957B
json
gansu
gan1_su4_jin1_chang1.json 124B
gan1_su4_tian1_shui3.json 446B
gan1_su4_lan2_zhou1.json 497B
gan1_su4_gan1_nan2_cang2_zu2_zi4_zhi4_zhou1.json 495B
gan1_su4_bai2_yin2.json 306B
gan1_su4_ping2_liang2.json 431B
gan1_su4_jia1_yu4_guan1.json 64B
gan1_su4_wu3_wei1.json 254B
gan1_su4_qing4_yang2.json 486B
gan1_su4_long3_nan2.json 539B
gan1_su4_zhang1_ye4.json 384B
gan1_su4_jiu3_quan2.json 459B
gan1_su4_ding4_xi1.json 425B
gan1_su4_lin2_xia4_hui2_zu2_zi4_zhi4_zhou1.json 536B
js
gansu_loader.js 5KB
shape-with-internal-borders
gansu
gan1_su4_wu3_wei1.js 30KB
gan1_su4_qing4_yang2.js 84KB
gan1_su4_jiu3_quan2.js 38KB
gan1_su4_bai2_yin2.js 40KB
gan1_su4_lin2_xia4_hui2_zu2_zi4_zhi4_zhou1.js 28KB
gan1_su4_zhang1_ye4.js 41KB
gan1_su4_ping2_liang2.js 48KB
gan1_su4_gan1_nan2_cang2_zu2_zi4_zhi4_zhou1.js 59KB
gan1_su4_lan2_zhou1.js 42KB
gan1_su4_ding4_xi1.js 54KB
gan1_su4_jia1_yu4_guan1.js 2KB
gan1_su4_tian1_shui3.js 49KB
gan1_su4_jin1_chang1.js 8KB
gan1_su4_long3_nan2.js 62KB
__init__.py 0B
parse-geojson.py 4KB
asyncJson.py 422B
3gansu.html 3KB
config.py 780B
geojson
gan1_su4_lan2_zhou1.geojson 582KB
gan1_su4_gan1_nan2_cang2_zu2_zi4_zhi4_zhou1.geojson 823KB
gan1_su4_qing4_yang2.geojson 1.17MB
gan1_su4_bai2_yin2.geojson 558KB
gan1_su4_ping2_liang2.geojson 675KB
gan1_su4_jin1_chang1.geojson 99KB
gan1_su4_wu3_wei1.geojson 421KB
gan1_su4_long3_nan2.geojson 874KB
gan1_su4_jiu3_quan2.geojson 505KB
gan1_su4_jia1_yu4_guan1.geojson 26KB
gan1_su4_zhang1_ye4.geojson 567KB
gan1_su4_tian1_shui3.geojson 684KB
gan1_su4_lin2_xia4_hui2_zu2_zi4_zhi4_zhou1.geojson 379KB
gan1_su4_ding4_xi1.geojson 763KB
util
jquery-3.6.0.min.js 87KB
echarts-5.2.0.min.js 988KB
共 52 条
- 1
资源评论
- qq_362706132022-07-14超赞的资源,感谢资源主分享,大家一起进步!
YYDataV数据可视化
- 粉丝: 3w+
- 资源: 121
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功