一、读取成都的边界坐标
http://datav.aliyun.com/portal/school/atlas/area_selector
从.json文件中读取边界坐标。
import json
import numpy as np
f = open('./data/chengdu2.json','r', encoding='UTF-8')
data = json.load(f)
data_coordinates = data['features'][0]['geometry']['coordinates']
print('data_coordinates.shape:', np.array(np.array(np.array(data_coordinates)[0])[0]).shape)
with open('./data/data6.txt','w') as ff:
for i in range(0, 5):
temp = np.array(np.array(np.array(data_coordinates)[i])[0])
print('temp:', temp.shape)
for a in range(0, temp.shape[0]):
ff.write(str(temp[a][0]) + ', ' + str(temp[a][1]) + ';')
# with open('data.txt','w') as f: #设置文件对象
# f.write(str) #将字符串写入文件中
二、网格化
参考链接
http://www.site-digger.com/html/articles/20201012/817.html
# codin
|