# -*- 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/120141713 4、技术支持QQ微信同号: 6550523,欢迎来撩~
资源推荐
资源详情
资源评论
收起资源包目录
【源码】数据可视化:基于Echarts + GeoJson实现的地图视觉映射散点(气泡)组件【5】 - 广西省.zip (52个子文件)
【源码】数据可视化:基于Echarts + GeoJson实现的地图视觉映射散点(气泡)组件【5】 - 广西省
httpserver.py 2KB
5guangxi.html 3KB
__pycache__
config.cpython-39.pyc 957B
json
guangxi
guang3_xi1_nan2_ning2.json 734B
guang3_xi1_liu3_zhou1.json 634B
guang3_xi1_lai2_bin1.json 382B
guang3_xi1_bei3_hai3.json 250B
guang3_xi1_fang2_cheng2_gang3.json 247B
guang3_xi1_chong2_zuo3.json 434B
guang3_xi1_yu4_lin2.json 428B
guang3_xi1_bai3_se4.json 748B
guang3_xi1_he2_chi2.json 747B
guang3_xi1_he4_zhou1.json 319B
guang3_xi1_gui4_gang3.json 305B
guang3_xi1_qin1_zhou1.json 244B
guang3_xi1_gui4_lin2.json 1KB
guang3_xi1_wu2_zhou1.json 425B
js
guangxi_loader.js 5KB
shape-with-internal-borders
guangxi
guang3_xi1_wu2_zhou1.js 52KB
guang3_xi1_lai2_bin1.js 46KB
guang3_xi1_qin1_zhou1.js 49KB
guang3_xi1_gui4_lin2.js 88KB
guang3_xi1_bei3_hai3.js 11KB
guang3_xi1_liu3_zhou1.js 53KB
guang3_xi1_bai3_se4.js 99KB
guang3_xi1_chong2_zuo3.js 59KB
guang3_xi1_nan2_ning2.js 94KB
guang3_xi1_he4_zhou1.js 33KB
guang3_xi1_gui4_gang3.js 47KB
guang3_xi1_yu4_lin2.js 72KB
guang3_xi1_he2_chi2.js 100KB
guang3_xi1_fang2_cheng2_gang3.js 18KB
__init__.py 0B
parse-geojson.py 4KB
asyncJson.py 424B
config.py 780B
geojson
guang3_xi1_lai2_bin1.geojson 651KB
guang3_xi1_he4_zhou1.geojson 459KB
guang3_xi1_gui4_gang3.geojson 662KB
guang3_xi1_wu2_zhou1.geojson 735KB
guang3_xi1_he2_chi2.geojson 1.38MB
guang3_xi1_yu4_lin2.geojson 1020KB
guang3_xi1_bai3_se4.geojson 1.37MB
guang3_xi1_chong2_zuo3.geojson 835KB
guang3_xi1_qin1_zhou1.geojson 695KB
guang3_xi1_bei3_hai3.geojson 137KB
guang3_xi1_nan2_ning2.geojson 1.3MB
guang3_xi1_fang2_cheng2_gang3.geojson 252KB
guang3_xi1_liu3_zhou1.geojson 737KB
guang3_xi1_gui4_lin2.geojson 1.2MB
util
jquery-3.6.0.min.js 87KB
echarts-5.2.0.min.js 988KB
共 52 条
- 1
资源评论
- nemo2uma2022-04-23用户下载后在一定时间内未进行评价,系统默认好评。
YYDataV数据可视化
- 粉丝: 3w+
- 资源: 121
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功